diff options
Diffstat (limited to 'pkgs/development/python-modules/torch')
5 files changed, 66 insertions, 78 deletions
diff --git a/pkgs/development/python-modules/torch/bin.nix b/pkgs/development/python-modules/torch/bin.nix index 5badb88d3750c..ac83f10157261 100644 --- a/pkgs/development/python-modules/torch/bin.nix +++ b/pkgs/development/python-modules/torch/bin.nix @@ -20,7 +20,7 @@ let pyVerNoDot = builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion; srcs = import ./binary-hashes.nix version; unsupported = throw "Unsupported system"; - version = "1.11.0"; + version = "1.12.1"; in buildPythonPackage { inherit version; @@ -68,7 +68,7 @@ in buildPythonPackage { pythonImportsCheck = [ "torch" ]; meta = with lib; { - description = "Open source, prototype-to-production deep learning platform"; + description = "PyTorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration"; homepage = "https://pytorch.org/"; changelog = "https://github.com/pytorch/pytorch/releases/tag/v${version}"; # Includes CUDA and Intel MKL, but redistributions of the binary are not limited. diff --git a/pkgs/development/python-modules/torch/binary-hashes.nix b/pkgs/development/python-modules/torch/binary-hashes.nix index fccc7ce642e77..2169e1873b0b5 100644 --- a/pkgs/development/python-modules/torch/binary-hashes.nix +++ b/pkgs/development/python-modules/torch/binary-hashes.nix @@ -6,61 +6,61 @@ # To add a new version, run "prefetch.sh 'new-version'" to paste the generated file as follows. version : builtins.getAttr version { - "1.11.0" = { + "1.12.1" = { x86_64-linux-37 = { - name = "torch-1.11.0-cp37-cp37m-linux_x86_64.whl"; - url = "https://download.pytorch.org/whl/cu113/torch-1.11.0%2Bcu113-cp37-cp37m-linux_x86_64.whl"; - hash = "sha256-9WMzRw2uo8lweLN2B+ADXMz3L8XDb9hFRuGkuNmUTys="; + name = "torch-1.12.1-cp37-cp37m-linux_x86_64.whl"; + url = "https://download.pytorch.org/whl/cu116/torch-1.12.1%2Bcu116-cp37-cp37m-linux_x86_64.whl"; + hash = "sha256-/JtHhuxUvmfqqLDHyZmeL0riuJocGOQd4VFaGQRAxpE="; }; x86_64-linux-38 = { - name = "torch-1.11.0-cp38-cp38-linux_x86_64.whl"; - url = "https://download.pytorch.org/whl/cu113/torch-1.11.0%2Bcu113-cp38-cp38-linux_x86_64.whl"; - hash = "sha256-tqeZvbbuPZFOXmK920J21KECSMGvTy0hdzjl+e4nSFs="; + name = "torch-1.12.1-cp38-cp38-linux_x86_64.whl"; + url = "https://download.pytorch.org/whl/cu116/torch-1.12.1%2Bcu116-cp38-cp38-linux_x86_64.whl"; + hash = "sha256-3aMSkBIgiVCHzIPTZlRko9wXHQRGDGHDGvRj77+1SJY="; }; x86_64-linux-39 = { - name = "torch-1.11.0-cp39-cp39-linux_x86_64.whl"; - url = "https://download.pytorch.org/whl/cu113/torch-1.11.0%2Bcu113-cp39-cp39-linux_x86_64.whl"; - hash = "sha256-6RJrCl2VcEvuQKnQ7xy9gtjceGPkY4o3a+9wLf1lk3A="; + name = "torch-1.12.1-cp39-cp39-linux_x86_64.whl"; + url = "https://download.pytorch.org/whl/cu116/torch-1.12.1%2Bcu116-cp39-cp39-linux_x86_64.whl"; + hash = "sha256-dyVCDavr/K9EmE7c4yg+6pH5jw99WHS8aMehZL2BJuM="; }; x86_64-linux-310 = { - name = "torch-1.11.0-cp310-cp310-linux_x86_64.whl"; - url = "https://download.pytorch.org/whl/cu113/torch-1.11.0%2Bcu113-cp310-cp310-linux_x86_64.whl"; - hash = "sha256-powzZXpUYTHrm8ROKpjS+nBKr66GFGCwUbgoE4Usy0Q="; + name = "torch-1.12.1-cp310-cp310-linux_x86_64.whl"; + url = "https://download.pytorch.org/whl/cu116/torch-1.12.1%2Bcu116-cp310-cp310-linux_x86_64.whl"; + hash = "sha256-trwxJEqigYkp+7MMSDwiHfRx6dhW6AXFof9ysTGunns="; }; x86_64-darwin-37 = { - name = "torch-1.11.0-cp37-none-macosx_10_9_x86_64.whl"; - url = "https://download.pytorch.org/whl/cpu/torch-1.11.0-cp37-none-macosx_10_9_x86_64.whl"; - hash = "sha256-aGCx0b8LsLZ6a9R/haDkyCW1GO6hO11hAZmdu8vVvAw="; + name = "torch-1.12.1-cp37-none-macosx_10_9_x86_64.whl"; + url = "https://download.pytorch.org/whl/cpu/torch-1.12.1-cp37-none-macosx_10_9_x86_64.whl"; + hash = "sha256-ijSi+7qgfJIeGyA/WdPW4A7TefKzhERXc70U4yiltsg="; }; x86_64-darwin-38 = { - name = "torch-1.11.0-cp38-none-macosx_10_9_x86_64.whl"; - url = "https://download.pytorch.org/whl/cpu/torch-1.11.0-cp38-none-macosx_10_9_x86_64.whl"; - hash = "sha256-DMyFzQYiej7fgJ4seV/Vdiw9Too4tcn3RMbnz4QTYbs="; + name = "torch-1.12.1-cp38-none-macosx_10_9_x86_64.whl"; + url = "https://download.pytorch.org/whl/cpu/torch-1.12.1-cp38-none-macosx_10_9_x86_64.whl"; + hash = "sha256-qDILqa2H6AylpqAW5GraTRugxUYm4TXZmyEppFQcUJ0="; }; x86_64-darwin-39 = { - name = "torch-1.11.0-cp39-none-macosx_10_9_x86_64.whl"; - url = "https://download.pytorch.org/whl/cpu/torch-1.11.0-cp39-none-macosx_10_9_x86_64.whl"; - hash = "sha256-UP2b+FxXjIccKPHLCs6d/GAkQBx/OZsXT7DzcImfRFQ="; + name = "torch-1.12.1-cp39-none-macosx_10_9_x86_64.whl"; + url = "https://download.pytorch.org/whl/cpu/torch-1.12.1-cp39-none-macosx_10_9_x86_64.whl"; + hash = "sha256-v+woQ9qmVPBP2iO6gjrwPntvdlCoc823JnUtDjcY2to="; }; x86_64-darwin-310 = { - name = "torch-1.11.0-cp310-none-macosx_10_9_x86_64.whl"; - url = "https://download.pytorch.org/whl/cpu/torch-1.11.0-cp39-none-macosx_10_9_x86_64.whl"; - hash = "sha256-UP2b+FxXjIccKPHLCs6d/GAkQBx/OZsXT7DzcImfRFQ="; + name = "torch-1.12.1-cp310-none-macosx_10_9_x86_64.whl"; + url = "https://download.pytorch.org/whl/cpu/torch-1.12.1-cp310-none-macosx_10_9_x86_64.whl"; + hash = "sha256-l2w/mXzqOO6RoN08OkIyJ4VBR0jRdh75JreJ36l8YTQ="; }; aarch64-darwin-38 = { - name = "torch-1.11.0-cp38-none-macosx_11_0_arm64.whl"; - url = "https://download.pytorch.org/whl/cpu/torch-1.11.0-cp38-none-macosx_11_0_arm64.whl"; - hash = "sha256-wVVOSddPGyw+cgLXcFa6LddGVDdYW6xkBitYD3FKROk="; + name = "torch-1.12.1-cp38-none-macosx_11_0_arm64.whl"; + url = "https://download.pytorch.org/whl/cpu/torch-1.12.1-cp38-none-macosx_11_0_arm64.whl"; + hash = "sha256-A+McN3Edss0gHgLeWCbeh1Up5FpVYx0xeq3OLx7UWqg="; }; aarch64-darwin-39 = { - name = "torch-1.11.0-cp39-none-macosx_11_0_arm64.whl"; - url = "https://download.pytorch.org/whl/cpu/torch-1.11.0-cp39-none-macosx_11_0_arm64.whl"; - hash = "sha256-DkivZq11Xw+cXyZkAopBT1fEnWrcN+d+Bv4ABNpO22E="; + name = "torch-1.12.1-cp39-none-macosx_11_0_arm64.whl"; + url = "https://download.pytorch.org/whl/cpu/torch-1.12.1-cp39-none-macosx_11_0_arm64.whl"; + hash = "sha256-af4srnw5zK3WWhI3k9MODbiB8cGSeUVRnFwXMjExQ34="; }; aarch64-darwin-310 = { - name = "torch-1.11.0-cp310-none-macosx_11_0_arm64.whl"; - url = "https://download.pytorch.org/whl/cpu/torch-1.11.0-cp39-none-macosx_11_0_arm64.whl"; - hash = "sha256-DkivZq11Xw+cXyZkAopBT1fEnWrcN+d+Bv4ABNpO22E="; + name = "torch-1.12.1-cp310-none-macosx_11_0_arm64.whl"; + url = "https://download.pytorch.org/whl/cpu/torch-1.12.1-cp310-none-macosx_11_0_arm64.whl"; + hash = "sha256-aBBORxWlXEuymoXGqNV9gg4HV9o2O+G6aA+ozFvhe1I="; }; }; } diff --git a/pkgs/development/python-modules/torch/breakpad-sigstksz.patch b/pkgs/development/python-modules/torch/breakpad-sigstksz.patch deleted file mode 100644 index 33a2304cb9b1a..0000000000000 --- a/pkgs/development/python-modules/torch/breakpad-sigstksz.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/third_party/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/src/client/linux/handler/exception_handler.cc -index ca353c4099..499be0a986 100644 ---- a/third_party/breakpad/src/client/linux/handler/exception_handler.cc -+++ b/third_party/breakpad/src/client/linux/handler/exception_handler.cc -@@ -138,7 +138,7 @@ void InstallAlternateStackLocked() { - // SIGSTKSZ may be too small to prevent the signal handlers from overrunning - // the alternative stack. Ensure that the size of the alternative stack is - // large enough. -- static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ); -+ const unsigned kSigStackSize = std::max<unsigned>(16384, SIGSTKSZ); - - // Only set an alternative stack if there isn't already one, or if the current - // one is too small. diff --git a/pkgs/development/python-modules/torch/default.nix b/pkgs/development/python-modules/torch/default.nix index 9d4c64861a3fb..672fcf75d3316 100644 --- a/pkgs/development/python-modules/torch/default.nix +++ b/pkgs/development/python-modules/torch/default.nix @@ -122,31 +122,26 @@ let in buildPythonPackage rec { pname = "torch"; # Don't forget to update torch-bin to the same version. - version = "1.11.0"; + version = "1.12.1"; format = "setuptools"; disabled = pythonOlder "3.7.0"; outputs = [ - "out" # output standard python package - "dev" # output libtorch headers - "lib" # output libtorch libraries + "out" # output standard python package + "dev" # output libtorch headers + "lib" # output libtorch libraries ]; src = fetchFromGitHub { - owner = "pytorch"; - repo = "pytorch"; - rev = "v${version}"; + owner = "pytorch"; + repo = "pytorch"; + rev = "refs/tags/v${version}"; fetchSubmodules = true; - sha256 = "sha256-CEu63tdRBAF8CTchO3Qu8gUNObQylX6U08yDTI4/c/0="; + hash = "sha256-8378BVOBFCRYRG1+yIYFSPKmb1rFOLgR+8pNZKt9NfI="; }; - patches = [ - # Fix for a breakpad incompatibility with glibc>2.33 - # https://github.com/pytorch/pytorch/issues/70297 - # https://github.com/google/breakpad/commit/605c51ed96ad44b34c457bbca320e74e194c317e - ./breakpad-sigstksz.patch - ] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ + patches = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ # pthreadpool added support for Grand Central Dispatch in April # 2020. However, this relies on functionality (DISPATCH_APPLY_AUTO) # that is available starting with macOS 10.13. However, our current @@ -208,7 +203,7 @@ in buildPythonPackage rec { PYTORCH_BUILD_VERSION = version; PYTORCH_BUILD_NUMBER = 0; - USE_SYSTEM_NCCL=setBool useSystemNccl; # don't build pytorch's third_party NCCL + USE_SYSTEM_NCCL = setBool useSystemNccl; # don't build pytorch's third_party NCCL # Suppress a weird warning in mkl-dnn, part of ideep in pytorch # (upstream seems to have fixed this in the wrong place?) @@ -243,15 +238,17 @@ in buildPythonPackage rec { pillow six future tensorboard protobuf ] ++ lib.optionals MPISupport [ mpi ]; - checkInputs = [ hypothesis ninja psutil ]; - # Tests take a long time and may be flaky, so just sanity-check imports doCheck = false; + pythonImportsCheck = [ "torch" ]; + checkInputs = [ hypothesis ninja psutil ]; + checkPhase = with lib.versions; with lib.strings; concatStringsSep " " [ + "runHook preCheck" cudaStubEnv "${python.interpreter} test/run_test.py" "--exclude" @@ -264,13 +261,15 @@ in buildPythonPackage rec { # tensorboard has acceptable failures for pytorch 1.3.x due to dependencies on tensorboard-plugins (optionalString (majorMinor version == "1.3" ) "tensorboard") ]) + "runHook postCheck" ]; + postInstall = '' find "$out/${python.sitePackages}/torch/include" "$out/${python.sitePackages}/torch/lib" -type f -exec remove-references-to -t ${stdenv.cc} '{}' + mkdir $dev cp -r $out/${python.sitePackages}/torch/include $dev/include - cp -r $out/${python.sitePackages}/torch/share $dev/share + cp -r $out/${python.sitePackages}/torch/share $dev/share # Fix up library paths for split outputs substituteInPlace \ @@ -282,7 +281,7 @@ in buildPythonPackage rec { --replace \''${_IMPORT_PREFIX}/lib "$lib/lib" mkdir $lib - mv $out/${python.sitePackages}/torch/lib $lib/lib + mv $out/${python.sitePackages}/torch/lib $lib/lib ln -s $lib/lib $out/${python.sitePackages}/torch/lib ''; @@ -312,11 +311,12 @@ in buildPythonPackage rec { }; meta = with lib; { - description = "Open source, prototype-to-production deep learning platform"; - homepage = "https://pytorch.org/"; - license = licenses.bsd3; + changelog = "https://github.com/pytorch/pytorch/releases/tag/v${version}"; + # keep PyTorch in the description so the package can be found under that name on search.nixos.org + description = "PyTorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration"; + homepage = "https://pytorch.org/"; + license = licenses.bsd3; maintainers = with maintainers; [ teh thoughtpolice tscholak ]; # tscholak esp. for darwin-related builds - platforms = with platforms; linux ++ lib.optionals (!cudaSupport) darwin; - broken = stdenv.isLinux && stdenv.isAarch64; + platforms = with platforms; linux ++ lib.optionals (!cudaSupport) darwin; }; } diff --git a/pkgs/development/python-modules/torch/prefetch.sh b/pkgs/development/python-modules/torch/prefetch.sh index 31aae438dc56d..78151ae787a52 100755 --- a/pkgs/development/python-modules/torch/prefetch.sh +++ b/pkgs/development/python-modules/torch/prefetch.sh @@ -5,14 +5,15 @@ set -eou pipefail version=$1 -linux_bucket="https://download.pytorch.org/whl/cu113" +linux_cuda_version="cu116" +linux_bucket="https://download.pytorch.org/whl/${linux_cuda_version}" darwin_bucket="https://download.pytorch.org/whl/cpu" url_and_key_list=( - "x86_64-linux-37 $linux_bucket/torch-${version}%2Bcu113-cp37-cp37m-linux_x86_64.whl torch-${version}-cp37-cp37m-linux_x86_64.whl" - "x86_64-linux-38 $linux_bucket/torch-${version}%2Bcu113-cp38-cp38-linux_x86_64.whl torch-${version}-cp38-cp38-linux_x86_64.whl" - "x86_64-linux-39 $linux_bucket/torch-${version}%2Bcu113-cp39-cp39-linux_x86_64.whl torch-${version}-cp39-cp39-linux_x86_64.whl" - "x86_64-linux-310 $linux_bucket/torch-${version}%2Bcu113-cp310-cp310-linux_x86_64.whl torch-${version}-cp310-cp310-linux_x86_64.whl" + "x86_64-linux-37 $linux_bucket/torch-${version}%2B${linux_cuda_version}-cp37-cp37m-linux_x86_64.whl torch-${version}-cp37-cp37m-linux_x86_64.whl" + "x86_64-linux-38 $linux_bucket/torch-${version}%2B${linux_cuda_version}-cp38-cp38-linux_x86_64.whl torch-${version}-cp38-cp38-linux_x86_64.whl" + "x86_64-linux-39 $linux_bucket/torch-${version}%2B${linux_cuda_version}-cp39-cp39-linux_x86_64.whl torch-${version}-cp39-cp39-linux_x86_64.whl" + "x86_64-linux-310 $linux_bucket/torch-${version}%2B${linux_cuda_version}-cp310-cp310-linux_x86_64.whl torch-${version}-cp310-cp310-linux_x86_64.whl" "x86_64-darwin-37 $darwin_bucket/torch-${version}-cp37-none-macosx_10_9_x86_64.whl torch-${version}-cp37-none-macosx_10_9_x86_64.whl" "x86_64-darwin-38 $darwin_bucket/torch-${version}-cp38-none-macosx_10_9_x86_64.whl torch-${version}-cp38-none-macosx_10_9_x86_64.whl" "x86_64-darwin-39 $darwin_bucket/torch-${version}-cp39-none-macosx_10_9_x86_64.whl torch-${version}-cp39-none-macosx_10_9_x86_64.whl" |