about summary refs log tree commit diff
path: root/pkgs/development/libraries/science/math/libtorch/bin.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/science/math/libtorch/bin.nix')
-rw-r--r--pkgs/development/libraries/science/math/libtorch/bin.nix13
1 files changed, 10 insertions, 3 deletions
diff --git a/pkgs/development/libraries/science/math/libtorch/bin.nix b/pkgs/development/libraries/science/math/libtorch/bin.nix
index 47a6249ebdc62..5b08cfa7dcf07 100644
--- a/pkgs/development/libraries/science/math/libtorch/bin.nix
+++ b/pkgs/development/libraries/science/math/libtorch/bin.nix
@@ -3,6 +3,7 @@
 , fetchzip
 , lib
 , libcxx
+, llvmPackages
 
 , addOpenGLRunpath
 , patchelf
@@ -17,11 +18,11 @@ let
   # this derivation. However, we should ensure on version bumps
   # that the CUDA toolkit for `passthru.tests` is still
   # up-to-date.
-  version = "2.0.0";
+  version = "2.3.0";
   device = if cudaSupport then "cuda" else "cpu";
   srcs = import ./binary-hashes.nix version;
   unavailable = throw "libtorch is not available for this platform";
-  libcxx-for-libtorch = if stdenv.hostPlatform.system == "x86_64-darwin" then libcxx else stdenv.cc.cc.lib;
+  libcxx-for-libtorch = if stdenv.isDarwin then libcxx else stdenv.cc.cc.lib;
 in stdenv.mkDerivation {
   inherit version;
   pname = "libtorch";
@@ -71,6 +72,9 @@ in stdenv.mkDerivation {
         otool -L $f
     done
     for f in $out/lib/*.dylib; do
+      if otool -L $f | grep "@rpath/libomp.dylib" >& /dev/null; then
+        install_name_tool -change "@rpath/libomp.dylib" ${llvmPackages.openmp}/lib/libomp.dylib $f
+      fi
       install_name_tool -id $out/lib/$(basename $f) $f || true
       for rpath in $(otool -L $f | grep rpath | awk '{print $1}');do
         install_name_tool -change $rpath $out/lib/$(basename $rpath) $f
@@ -99,6 +103,9 @@ in stdenv.mkDerivation {
     # https://www.intel.com/content/www/us/en/developer/articles/license/onemkl-license-faq.html
     license = licenses.bsd3;
     maintainers = with maintainers; [ junjihashimoto ];
-    platforms = platforms.unix;
+    platforms = [
+      "aarch64-darwin"
+      "x86_64-linux"
+    ];
   };
 }