Skip to content

Commit

Permalink
python312Packages.torch: unroll recursive git retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
Isidor Zeuner committed Nov 3, 2024
1 parent 03b6d7f commit c243f04
Show file tree
Hide file tree
Showing 2 changed files with 716 additions and 6 deletions.
39 changes: 33 additions & 6 deletions pkgs/development/python-modules/torch/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
stdenv,
lib,
fetchFromGitHub,
fetchFromGitLab,
fetchFromGitea,
buildPythonPackage,
python,
runCommand,
writeShellScript,
config,
cudaSupport ? config.cudaSupport,
cudaPackages,
Expand Down Expand Up @@ -219,6 +223,27 @@ let
"Rocm support is currently broken because `rocmPackages.hipblaslt` is unpackaged. (2024-06-09)" =
rocmSupport;
};

git-unroll = fetchFromGitea {
domain = "codeberg.org";
owner = "gm6k";
repo = "git-unroll";
rev = "96bf24f2af153310ec59979c123a8cefda8636db";
hash = "sha256-BTlq2Pm4l/oypBzKKpxExVPyQ0CcAP8llUnl/fd3DUU=";
};

unroll-src = writeShellScript "unroll-src" ''
echo "{
version,
fetchFromGitLab,
fetchFromGitHub,
runCommand,
}:
assert version == "'"'$1'"'";"
${git-unroll}/unroll https://github.com/pytorch/pytorch v$1
echo
echo "# Update using: unroll-src [version]"
'';
in
buildPythonPackage rec {
pname = "torch";
Expand All @@ -234,12 +259,13 @@ buildPythonPackage rec {
];
cudaPropagateToOutput = "cxxdev";

src = fetchFromGitHub {
owner = "pytorch";
repo = "pytorch";
rev = "refs/tags/v${version}";
fetchSubmodules = true;
hash = "sha256-17lgAcqJN+vir+Zvffy5cXRmNjd5Y80ev8b8pOj9F+g=";
src = callPackage ./src.nix {
inherit
version
fetchFromGitHub
fetchFromGitLab
runCommand
;
};

patches =
Expand Down Expand Up @@ -669,6 +695,7 @@ buildPythonPackage rec {
cudaPackages
rocmSupport
rocmPackages
unroll-src
;
cudaCapabilities = if cudaSupport then supportedCudaCapabilities else [ ];
# At least for 1.10.2 `torch.fft` is unavailable unless BLAS provider is MKL. This attribute allows for easy detection of its availability.
Expand Down
Loading

0 comments on commit c243f04

Please sign in to comment.