about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSomeone Serge <sergei.kozlukov@aalto.fi>2022-04-13 02:37:57 +0300
committerSomeone Serge <sergei.kozlukov@aalto.fi>2023-04-01 05:48:32 +0300
commit2e5cb6f4d66f60dbb690064f5d2a5f74652cf36b (patch)
tree21d4cd97af4aad3dd4f9199d82e1b006851c9f4e
parent6087a4301c2a7b47a84b6632e079b977af537cd2 (diff)
nvidia-thrust: simplify parameters
-rw-r--r--pkgs/development/libraries/nvidia-thrust/default.nix22
-rw-r--r--pkgs/top-level/all-packages.nix5
2 files changed, 10 insertions, 17 deletions
diff --git a/pkgs/development/libraries/nvidia-thrust/default.nix b/pkgs/development/libraries/nvidia-thrust/default.nix
index 13f562f24d230..f8b7518cd0815 100644
--- a/pkgs/development/libraries/nvidia-thrust/default.nix
+++ b/pkgs/development/libraries/nvidia-thrust/default.nix
@@ -4,32 +4,24 @@
 , stdenv
 , cmake
 , pkg-config
-, cudaSupport ? config.cudaSupport or false
 , cudaPackages
 , symlinkJoin
-, enableOpenmp ? true
-, enableTbb ? false
 , tbb
+  # Upstream defaults:
 , hostSystem ? "CPP"
-, deviceSystem ? let
-    devices = lib.optional cudaSupport "CUDA"
-      ++ lib.optional enableTbb "TBB"
-      ++ lib.optional enableOpenmp "OMP"
-      ++ [ "CPP" ];
-  in
-  builtins.head devices
+, deviceSystem ? if config.cudaSupport or false then "CUDA" else "CPP"
 }:
 
 assert builtins.elem deviceSystem [ "CPP" "OMP" "TBB" "CUDA" ];
 assert builtins.elem hostSystem [ "CPP" "OMP" "TBB" ];
-assert (deviceSystem == "CUDA") -> cudaSupport;
-assert (builtins.elem "TBB" [ deviceSystem hostSystem ]) -> enableTbb;
-assert (builtins.elem "OMP" [ deviceSystem hostSystem ]) -> enableOpenmp;
 
 let
   pname = "nvidia-thrust";
   version = "1.16.0";
 
+  tbbSupport = builtins.elem "TBB" [ deviceSystem hostSystem ];
+  cudaSupport = deviceSystem == "CUDA";
+
   # TODO: Would like to use this:
   cudaJoined = symlinkJoin {
     name = "cuda-packages-unsplit";
@@ -51,13 +43,13 @@ stdenv.mkDerivation {
     hash = "sha256-/EyznxWKuHuvHNjq+SQg27IaRbtkjXR2zlo2YgCWmUQ=";
   };
 
-  buildInputs = lib.optional enableTbb tbb;
+  buildInputs = lib.optionals tbbSupport [ tbb ];
 
   nativeBuildInputs = [
     cmake
     pkg-config
   ] ++ lib.optionals cudaSupport [
-    # goes in native build inputs because thrust looks for headers
+    # Goes in native build inputs because thrust looks for headers
     # in a path relative to nvcc...
 
     # Works when build=host, but we only support
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6db3ce73e06eb..18bade5fc0ff4 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -10309,11 +10309,12 @@ with pkgs;
   nvidia-thrust = callPackage ../development/libraries/nvidia-thrust { };
 
   nvidia-thrust-intel = callPackage ../development/libraries/nvidia-thrust {
-    enableTbb = true;
+    hostSystem = "TBB";
+    deviceSystem = if config.cudaSupport or false then "CUDA" else "TBB";
   };
 
   nvidia-thrust-cuda = callPackage ../development/libraries/nvidia-thrust {
-    cudaSupport = true;
+    deviceSystem = "CUDA";
   };
 
   miller = callPackage ../tools/text/miller { };