about summary refs log tree commit diff
path: root/pkgs/development/cuda-modules
diff options
context:
space:
mode:
authorSomeone Serge <sergei.kozlukov@aalto.fi>2023-12-22 03:36:45 +0000
committerSomeone Serge <sergei.kozlukov@aalto.fi>2023-12-22 03:49:24 +0000
commit6ac1e13d33f3e75b14d4a1aaca97c52517e6da11 (patch)
tree4d143a1707ef612e38b2edfcd3bcf88c62f1d957 /pkgs/development/cuda-modules
parentd6450daf5dcc078592231bcd9affd2b353a16e16 (diff)
downloadnixlib-6ac1e13d33f3e75b14d4a1aaca97c52517e6da11.tar
nixlib-6ac1e13d33f3e75b14d4a1aaca97c52517e6da11.tar.gz
nixlib-6ac1e13d33f3e75b14d4a1aaca97c52517e6da11.tar.bz2
nixlib-6ac1e13d33f3e75b14d4a1aaca97c52517e6da11.tar.lz
nixlib-6ac1e13d33f3e75b14d4a1aaca97c52517e6da11.tar.xz
nixlib-6ac1e13d33f3e75b14d4a1aaca97c52517e6da11.tar.zst
nixlib-6ac1e13d33f3e75b14d4a1aaca97c52517e6da11.zip
cudaPackages.cuda_nvcc: pin the backend cc
This makes @ccRoot@ in setupCudaHook redundant when used with
the redist cuda packages. We do not touch setupCudaHook yet,
because we still have to address the deprecated cudaPackages.cudatoolkit
Diffstat (limited to 'pkgs/development/cuda-modules')
-rw-r--r--pkgs/development/cuda-modules/cuda/overrides.nix26
1 files changed, 23 insertions, 3 deletions
diff --git a/pkgs/development/cuda-modules/cuda/overrides.nix b/pkgs/development/cuda-modules/cuda/overrides.nix
index 92b4a21fe772..12e14ef9965b 100644
--- a/pkgs/development/cuda-modules/cuda/overrides.nix
+++ b/pkgs/development/cuda-modules/cuda/overrides.nix
@@ -73,17 +73,37 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
 
       # Cf. https://web.archive.org/web/20230308044351/https://arcb.csc.ncsu.edu/~mueller/cluster/nvidia/2.0/nvcc_2.0.pdf
 
+      # We set all variables with the lowest priority (=+), but we do force
+      # nvcc to use the fixed backend toolchain. Cf. comments in
+      # backend-stdenv.nix
+
       postPatch =
         (oldAttrs.postPatch or "")
         + ''
           substituteInPlace bin/nvcc.profile \
             --replace \
               '$(TOP)/lib' \
-              "''${!outputLib}/lib"
+              "''${!outputLib}/lib" \
+            --replace \
+              '$(TOP)/$(_NVVM_BRANCH_)' \
+              "''${!outputBin}/nvvm" \
+            --replace \
+              '$(TOP)/$(_TARGET_DIR_)/include' \
+              "''${!outputDev}/include"
 
           cat << EOF >> bin/nvcc.profile
-          LIBRARIES +=  "-L''${!outputBin}/nvvm/lib" "-L$static/lib" "-L${final.cuda_cudart.lib}/lib" "-L${final.cuda_cudart.lib}/lib/stubs"
-          INCLUDES += "-I''${!outputDev}/include" "-I''${!outputBin}/nvvm/include" "-I${final.cuda_cudart.dev}/include"
+
+          # Fix a compatible backend compiler
+          PATH += ${lib.getBin final.backendStdenv.cc}/bin:
+          LIBRARIES += "-L${lib.getLib final.backendStdenv.nixpkgsCompatibleLibstdcxx}/lib"
+
+          # Expose the split-out nvvm
+          LIBRARIES =+ -L''${!outputBin}/nvvm/lib
+          INCLUDES =+ -I''${!outputBin}/nvvm/include
+
+          # Expose cudart and the libcuda stubs
+          LIBRARIES =+ -L$static/lib" "-L${final.cuda_cudart.lib}/lib -L${final.cuda_cudart.lib}/lib/stubs
+          INCLUDES =+ -I${final.cuda_cudart.dev}/include
           EOF
         '';