Skip to content

Commit

Permalink
rPackages.torch: use binary
Browse files Browse the repository at this point in the history
  • Loading branch information
b-rodrigues committed Aug 9, 2024
1 parent 6d08aae commit 291f72c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions pkgs/development/r-modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1803,10 +1803,23 @@ let
'';
});

torch = old.torch.overrideAttrs (attrs: {
preConfigure = ''
patchShebangs configure
'';
torch = let
# Sets the correct string to download either the binary for
# the cpu version of the torch package, or the
# the cuda-enabled version.
# To use gpu acceleration, set `config.cudaSupport = true;`
# when importing nixpkgs in your shell
accel = if pkgs.config.cudaSupport then "cu118" else "cpu";

binary_sha = if pkgs.config.cudaSupport then
"sha256-a80sG89C0svZzkjNRpY0rTR2P1JdvKAbWDGIIghsv2Y=" else
"sha256-qUn8Rot6ME7iTvtNd52iw3ebqMnpLz7kwl/9GoPHD+I=";
in
old.torch.overrideAttrs (attrs: {
src = pkgs.fetchzip {
url = "https://torch-cdn.mlverse.org/packages/${accel}/0.13.0/src/contrib/torch_0.13.0_R_x86_64-pc-linux-gnu.tar.gz";
sha256 = binary_sha;
};
});

pak = old.pak.overrideAttrs (attrs: {
Expand Down

0 comments on commit 291f72c

Please sign in to comment.