about summary refs log tree commit diff
path: root/pkgs/applications/science/chemistry
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 /pkgs/applications/science/chemistry
parent242544ca1716350725294bbb347d3bd039d1a0e8 (diff)
downloadnixlib-9709e96e1e62b925e9f68809040913169fe07d74.tar
nixlib-9709e96e1e62b925e9f68809040913169fe07d74.tar.gz
nixlib-9709e96e1e62b925e9f68809040913169fe07d74.tar.bz2
nixlib-9709e96e1e62b925e9f68809040913169fe07d74.tar.lz
nixlib-9709e96e1e62b925e9f68809040913169fe07d74.tar.xz
nixlib-9709e96e1e62b925e9f68809040913169fe07d74.tar.zst
nixlib-9709e96e1e62b925e9f68809040913169fe07d74.zip
treewide: make 'gpuBackend' use 'config.(cuda|rocm)Support'
Diffstat (limited to 'pkgs/applications/science/chemistry')
-rw-r--r--pkgs/applications/science/chemistry/cp2k/default.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgs/applications/science/chemistry/cp2k/default.nix b/pkgs/applications/science/chemistry/cp2k/default.nix
index 5bc0dddd79b6..16eabbcbcaa1 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" ];