diff --git a/pkgs/development/libraries/science/math/libtorch/bin.nix b/pkgs/development/libraries/science/math/libtorch/bin.nix index 47a6249ebdc626..cfdfeda351638c 100644 --- a/pkgs/development/libraries/science/math/libtorch/bin.nix +++ b/pkgs/development/libraries/science/math/libtorch/bin.nix @@ -17,11 +17,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.2.2"; 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"; @@ -99,6 +99,10 @@ 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-darwin" + "x86_64-linux" + ]; }; } diff --git a/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix b/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix index 83533d89b1e8b9..b862b569786995 100644 --- a/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix +++ b/pkgs/development/libraries/science/math/libtorch/binary-hashes.nix @@ -1,19 +1,24 @@ -version : builtins.getAttr version { - "2.0.0" = { +version: builtins.getAttr version { + "2.2.2" = { + aarch64-darwin-cpu = { + name = "libtorch-macos-arm64-2.2.2.zip"; + url = "https://download.pytorch.org/libtorch/cpu/libtorch-macos-arm64-2.2.2.zip"; + hash = "sha256-zXviMxGW0wpJDIbb++qaJLL8OwJPuT38KqRRXkEFGeA="; + }; x86_64-darwin-cpu = { - name = "libtorch-macos-2.0.0.zip"; - url = "https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.0.0.zip"; - hash = "sha256-u6y5IeYoiOC0yQ/k6JCChDs9lXWccLxUorgR8L62lkM="; + name = "libtorch-macos-x86_64-2.2.2.zip"; + url = "https://download.pytorch.org/libtorch/cpu/libtorch-macos-x86_64-2.2.2.zip"; + hash = "sha256-GcMf+0Cwfz6D8FC5bhtxCdBC4NgysO+2xA7EqXeb2fk="; }; x86_64-linux-cpu = { - name = "libtorch-cxx11-abi-shared-with-deps-2.0.0-cpu.zip"; - url = "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip"; - hash = "sha256-BoZQ2MC1CDVVGfX3SHC3mEpLGWO8XK7AcLcHJXDsXuc="; + name = "libtorch-cxx11-abi-shared-with-deps-2.2.2-cpu.zip"; + url = "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.2.2%2Bcpu.zip"; + hash = "sha256-REVmlpMC9xGHfKXtPbw1wOzhNf+G0wNRJBwmwen8fLE="; }; x86_64-linux-cuda = { - name = "libtorch-cxx11-abi-shared-with-deps-2.0.0-cu118.zip"; - url = "https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcu118.zip"; - hash = "sha256-Dpw9kQdA1NI9EOT7JBKwQP4wZT6lizcnKKTQ8WVJCZc="; + name = "libtorch-cxx11-abi-shared-with-deps-2.2.2-cu121.zip"; + url = "https://download.pytorch.org/libtorch/cu121/libtorch-cxx11-abi-shared-with-deps-2.2.2%2Bcu121.zip"; + hash = "sha256-UO5sz4tTQrWrnrjlWiwt1khdmGeSNRU9L5h7i/Ez+tk="; }; }; } diff --git a/pkgs/development/libraries/science/math/libtorch/prefetch.sh b/pkgs/development/libraries/science/math/libtorch/prefetch.sh index 5c6d60ae8b2082..2682fe6779768f 100755 --- a/pkgs/development/libraries/science/math/libtorch/prefetch.sh +++ b/pkgs/development/libraries/science/math/libtorch/prefetch.sh @@ -6,10 +6,11 @@ set -eou pipefail version=$1 bucket="https://download.pytorch.org/libtorch" -CUDA_VERSION=cu116 +CUDA_VERSION=cu121 url_and_key_list=( - "x86_64-darwin-cpu $bucket/cpu/libtorch-macos-${version}.zip libtorch-macos-${version}.zip" + "aarch64-darwin-cpu $bucket/cpu/libtorch-macos-arm64-${version}.zip libtorch-macos-arm64-${version}.zip" + "x86_64-darwin-cpu $bucket/cpu/libtorch-macos-x86_64-${version}.zip libtorch-macos-x86_64-${version}.zip" "x86_64-linux-cpu $bucket/cpu/libtorch-cxx11-abi-shared-with-deps-${version}%2Bcpu.zip libtorch-cxx11-abi-shared-with-deps-${version}-cpu.zip" "x86_64-linux-cuda $bucket/${CUDA_VERSION}/libtorch-cxx11-abi-shared-with-deps-${version}%2B${CUDA_VERSION}.zip libtorch-cxx11-abi-shared-with-deps-${version}-${CUDA_VERSION}.zip" )