Martin Weinelt 2022-08-30 20:42:49 +02:00
parent ac45560964
commit 9b183572a7
No known key found for this signature in database
GPG key ID: 87C1E9888F856759
3 changed files with 24 additions and 38 deletions

View file

@ -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.

View file

@ -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;
};
}

View file

@ -10929,7 +10929,6 @@ in {
torch-bin = callPackage ../development/python-modules/torch/bin.nix { };
torchWithCuda = self.torch.override {
cudaSupport = true;
};