about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadoura <madouura@gmail.com>2023-11-14 08:41:58 -0600
committerMadoura <madouura@gmail.com>2023-11-14 08:44:42 -0600
commit9709e96e1e62b925e9f68809040913169fe07d74 (patch)
tree46b75facec5049836bbb4369b34c70d001a71793
parent242544ca1716350725294bbb347d3bd039d1a0e8 (diff)
treewide: make 'gpuBackend' use 'config.(cuda|rocm)Support'
-rw-r--r--pkgs/applications/science/chemistry/cp2k/default.nix11
-rw-r--r--pkgs/by-name/si/sirius/package.nix9
-rw-r--r--pkgs/by-name/sp/spfft/package.nix9
-rw-r--r--pkgs/by-name/sp/spla/package.nix9
4 files changed, 33 insertions, 5 deletions
diff --git a/pkgs/applications/science/chemistry/cp2k/default.nix b/pkgs/applications/science/chemistry/cp2k/default.nix
index 5bc0dddd79b67..16eabbcbcaa1f 100644
--- a/pkgs/applications/science/chemistry/cp2k/default.nix
+++ b/pkgs/applications/science/chemistry/cp2k/default.nix
@@ -28,8 +28,16 @@
 , spfft
 , enableElpa ? false
 , elpa
-, gpuBackend ? "none"
 , cudaPackages
+, rocmPackages
+, config
+, gpuBackend ? (
+  if config.cudaSupport
+  then "cuda"
+  else if config.rocmSupport
+  then "rocm"
+  else "none"
+)
 # gpuVersion needs to be set for both CUDA as well as ROCM hardware.
 # gpuArch is only required for the ROCM stack.
 # Change to a value suitable for your target GPU.
@@ -37,7 +45,6 @@
 # and for Nvidia see https://github.com/cp2k/cp2k/blob/master/INSTALL.md#2i-cuda-optional-improved-performance-on-gpu-systems
 , gpuVersion ? "Mi100"
 , gpuArch ? "gfx908"
-, rocmPackages
 }:
 
 assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
diff --git a/pkgs/by-name/si/sirius/package.nix b/pkgs/by-name/si/sirius/package.nix
index 2af3c28de9221..8518092203b8e 100644
--- a/pkgs/by-name/si/sirius/package.nix
+++ b/pkgs/by-name/si/sirius/package.nix
@@ -21,9 +21,16 @@
 , eigen
 , libvdwxc
 , llvmPackages
-, gpuBackend ? "none"
 , cudaPackages
 , rocmPackages
+, config
+, gpuBackend ? (
+  if config.cudaSupport
+  then "cuda"
+  else if config.rocmSupport
+  then "rocm"
+  else "none"
+)
 }:
 
 assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
diff --git a/pkgs/by-name/sp/spfft/package.nix b/pkgs/by-name/sp/spfft/package.nix
index 72ae473d14a5f..55b20defd53c1 100644
--- a/pkgs/by-name/sp/spfft/package.nix
+++ b/pkgs/by-name/sp/spfft/package.nix
@@ -6,9 +6,16 @@
 , mpi
 , gfortran
 , llvmPackages
-, gpuBackend ? "none"
 , cudaPackages
 , rocmPackages
+, config
+, gpuBackend ? (
+  if config.cudaSupport
+  then "cuda"
+  else if config.rocmSupport
+  then "rocm"
+  else "none"
+)
 }:
 
 assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
diff --git a/pkgs/by-name/sp/spla/package.nix b/pkgs/by-name/sp/spla/package.nix
index 1f8abde4b7230..210fb04af9b80 100644
--- a/pkgs/by-name/sp/spla/package.nix
+++ b/pkgs/by-name/sp/spla/package.nix
@@ -6,9 +6,16 @@
 , blas
 , gfortran
 , llvmPackages
-, gpuBackend ? "none"
 , cudaPackages
 , rocmPackages
+, config
+, gpuBackend ? (
+  if config.cudaSupport
+  then "cuda"
+  else if config.rocmSupport
+  then "rocm"
+  else "none"
+)
 }:
 
 assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];