Skip to content

Commit

Permalink
feat(overlays/torch): add /run/opengl-driver/lib to RPATH
Browse files Browse the repository at this point in the history
This allows resolving libcuda.so.1
  • Loading branch information
DavHau committed Sep 12, 2023
1 parent 8d5178a commit 77eeb06
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion overrides/python/torch/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
lib,
...
}: {
env.autoPatchelfIgnoreMissingDeps = ["libcuda.so.1"];
# stripping doesn't reduce the file size much, and it takes a long time
mkDerivation.dontStrip = true;

# this file is patched manually, so ignore it in autoPatchelf
env.autoPatchelfIgnoreMissingDeps = ["libcuda.so.1"];
# patch the rpath so libcuda.so.1 can be found at /run/opengl-driver/lib
env.cudaPatchPhase = ''
patchelf $out/${config.deps.python.sitePackages}/torch/lib/libcaffe2_nvrtc.so \
--add-rpath /run/opengl-driver/lib
'';
mkDerivation.postPhases = ["cudaPatchPhase"];
}

0 comments on commit 77eeb06

Please sign in to comment.