about summary refs log tree commit diff
path: root/pkgs/development/python-modules/jaxlib
diff options
context:
space:
mode:
authorYann Hamdaoui <yann.hamdaoui@tweag.io>2024-01-17 16:32:24 +0100
committerYann Hamdaoui <yann.hamdaoui@tweag.io>2024-03-15 15:54:21 +0100
commit63746cac08fe242003947167550d28ebc182bf77 (patch)
tree54e1172b75850dfdd823f7fa94601e9e495c402a /pkgs/development/python-modules/jaxlib
parent6a9c892aec57608b49c5ffc524629a3550e8efe6 (diff)
downloadnixlib-63746cac08fe242003947167550d28ebc182bf77.tar
nixlib-63746cac08fe242003947167550d28ebc182bf77.tar.gz
nixlib-63746cac08fe242003947167550d28ebc182bf77.tar.bz2
nixlib-63746cac08fe242003947167550d28ebc182bf77.tar.lz
nixlib-63746cac08fe242003947167550d28ebc182bf77.tar.xz
nixlib-63746cac08fe242003947167550d28ebc182bf77.tar.zst
nixlib-63746cac08fe242003947167550d28ebc182bf77.zip
cudaPackages: generalize and refactor setup hook
This PR refactor CUDA setup hooks, and in particular
autoAddOpenGLRunpath and autoAddCudaCompatRunpathHook, that were using a
lot of code in common (in fact, I introduced the latter by copy pasting
most of the bash script of the former). This is not satisfying for
maintenance, as a recent patch showed, because we need to duplicate
changes to both hooks.

This commit abstract the common part in a single shell script that
applies a generic patch action to every elf file in the output. For
autoAddOpenGLRunpath the action is just addOpenGLRunpath (now
addDriverRunpath), and is few line function for
autoAddCudaCompatRunpathHook.

Doing so, we also takes the occasion to use the newer addDriverRunpath
instead of the previous addOpenGLRunpath, and rename the CUDA hook to
reflect that as well.

Co-Authored-By: Connor Baker <connor.baker@tweag.io>
Diffstat (limited to 'pkgs/development/python-modules/jaxlib')
-rw-r--r--pkgs/development/python-modules/jaxlib/bin.nix4
-rw-r--r--pkgs/development/python-modules/jaxlib/default.nix4
2 files changed, 4 insertions, 4 deletions
diff --git a/pkgs/development/python-modules/jaxlib/bin.nix b/pkgs/development/python-modules/jaxlib/bin.nix
index 199b352b2aa2..e2260aec4b14 100644
--- a/pkgs/development/python-modules/jaxlib/bin.nix
+++ b/pkgs/development/python-modules/jaxlib/bin.nix
@@ -23,7 +23,7 @@
 }:
 
 let
-  inherit (cudaPackagesGoogle) autoAddOpenGLRunpathHook cudaVersion;
+  inherit (cudaPackagesGoogle) autoAddDriverRunpath cudaVersion;
 
   version = "0.4.24";
 
@@ -180,7 +180,7 @@ buildPythonPackage {
   # Prebuilt wheels are dynamically linked against things that nix can't find.
   # Run `autoPatchelfHook` to automagically fix them.
   nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ]
-    ++ lib.optionals cudaSupport [ autoAddOpenGLRunpathHook ];
+    ++ lib.optionals cudaSupport [ autoAddDriverRunpath ];
   # Dynamic link dependencies
   buildInputs = [ stdenv.cc.cc.lib ];
 
diff --git a/pkgs/development/python-modules/jaxlib/default.nix b/pkgs/development/python-modules/jaxlib/default.nix
index 657a6e52c084..cbce801888e2 100644
--- a/pkgs/development/python-modules/jaxlib/default.nix
+++ b/pkgs/development/python-modules/jaxlib/default.nix
@@ -51,7 +51,7 @@
 }@inputs:
 
 let
-  inherit (cudaPackagesGoogle) autoAddOpenGLRunpathHook cudaFlags cudaVersion cudnn nccl;
+  inherit (cudaPackagesGoogle) autoAddDriverRunpath cudaFlags cudaVersion cudnn nccl;
 
   pname = "jaxlib";
   version = "0.4.24";
@@ -420,7 +420,7 @@ buildPythonPackage {
     done
   '';
 
-  nativeBuildInputs = lib.optionals cudaSupport [ autoAddOpenGLRunpathHook ];
+  nativeBuildInputs = lib.optionals cudaSupport [ autoAddDriverRunpath ];
 
   propagatedBuildInputs = [
     absl-py