diff --git a/doc/languages-frameworks/cuda.section.md b/doc/languages-frameworks/cuda.section.md index 6b19e02e74e9..b7f1f19546a7 100644 --- a/doc/languages-frameworks/cuda.section.md +++ b/doc/languages-frameworks/cuda.section.md @@ -12,8 +12,11 @@ compatible are available as well. For example, there can be a To use one or more CUDA packages in an expression, give the expression a `cudaPackages` parameter, and in case CUDA is optional ```nix -cudaSupport ? false -cudaPackages ? {} +{ config +, cudaSupport ? config.cudaSupport +, cudaPackages ? { } +, ... +}: ``` When using `callPackage`, you can choose to pass in a different variant, e.g. diff --git a/pkgs/applications/graphics/digikam/default.nix b/pkgs/applications/graphics/digikam/default.nix index ab75938760b3..8a95d10203c4 100644 --- a/pkgs/applications/graphics/digikam/default.nix +++ b/pkgs/applications/graphics/digikam/default.nix @@ -54,7 +54,7 @@ , breeze-icons , oxygen -, cudaSupport ? config.cudaSupport or false +, cudaSupport ? config.cudaSupport , cudaPackages ? {} }: diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index 81b7a54a754d..f6f5edc84ef8 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/pkgs/applications/misc/blender/default.nix @@ -5,7 +5,7 @@ , openvdb, libXxf86vm, tbb, alembic , zlib, zstd, fftw, opensubdiv, freetype, jemalloc, ocl-icd, addOpenGLRunpath , jackaudioSupport ? false, libjack2 -, cudaSupport ? config.cudaSupport or false, cudaPackages ? {} +, cudaSupport ? config.cudaSupport, cudaPackages ? { } , hipSupport ? false, hip # comes with a significantly larger closure size , colladaSupport ? true, opencollada , spaceNavSupport ? stdenv.isLinux, libspnav diff --git a/pkgs/applications/science/math/caffe/default.nix b/pkgs/applications/science/math/caffe/default.nix index 4cd2511786b3..5af927294d6c 100644 --- a/pkgs/applications/science/math/caffe/default.nix +++ b/pkgs/applications/science/math/caffe/default.nix @@ -13,7 +13,7 @@ , Accelerate, CoreGraphics, CoreVideo , lmdbSupport ? true, lmdb , leveldbSupport ? true, leveldb, snappy -, cudaSupport ? config.cudaSupport or false, cudaPackages ? {} +, cudaSupport ? config.cudaSupport, cudaPackages ? { } , cudnnSupport ? cudaSupport , ncclSupport ? false , pythonSupport ? false, python ? null, numpy ? null diff --git a/pkgs/applications/science/math/cntk/default.nix b/pkgs/applications/science/math/cntk/default.nix index f885dae444ba..91d208a56ede 100644 --- a/pkgs/applications/science/math/cntk/default.nix +++ b/pkgs/applications/science/math/cntk/default.nix @@ -2,7 +2,8 @@ , fetchpatch , openblas, blas, lapack, opencv3, libzip, boost, protobuf, mpi , onebitSGDSupport ? false -, cudaSupport ? false, cudaPackages ? {}, addOpenGLRunpath, cudatoolkit, nvidia_x11 +, config +, cudaSupport ? config.cudaSupport, cudaPackages ? { }, addOpenGLRunpath, cudatoolkit, nvidia_x11 , cudnnSupport ? cudaSupport }: diff --git a/pkgs/applications/science/math/mathematica/default.nix b/pkgs/applications/science/math/mathematica/default.nix index c0f370d88457..289c9b7b6580 100644 --- a/pkgs/applications/science/math/mathematica/default.nix +++ b/pkgs/applications/science/math/mathematica/default.nix @@ -2,7 +2,7 @@ , config , lib , cudaPackages -, cudaSupport ? config.cudaSupport or false +, cudaSupport ? config.cudaSupport , lang ? "en" , webdoc ? false , version ? null diff --git a/pkgs/applications/science/math/mxnet/default.nix b/pkgs/applications/science/math/mxnet/default.nix index 240a1759397f..1e7af371c509 100644 --- a/pkgs/applications/science/math/mxnet/default.nix +++ b/pkgs/applications/science/math/mxnet/default.nix @@ -1,6 +1,6 @@ { config, stdenv, lib, fetchurl, fetchpatch, bash, cmake , opencv3, gtest, blas, gomp, llvmPackages, perl -, cudaSupport ? config.cudaSupport or false, cudaPackages ? {}, nvidia_x11 +, cudaSupport ? config.cudaSupport, cudaPackages ? { }, nvidia_x11 , cudnnSupport ? cudaSupport }: diff --git a/pkgs/applications/science/misc/colmap/default.nix b/pkgs/applications/science/misc/colmap/default.nix index e3ce66356ba6..a029f5440b25 100644 --- a/pkgs/applications/science/misc/colmap/default.nix +++ b/pkgs/applications/science/misc/colmap/default.nix @@ -1,6 +1,7 @@ { mkDerivation, lib, fetchFromGitHub, cmake, boost179, ceres-solver, eigen, freeimage, glog, libGLU, glew, qtbase, - cudaSupport ? false, cudaPackages }: + config, + cudaSupport ? config.cudaSupport, cudaPackages }: assert cudaSupport -> cudaPackages != { }; diff --git a/pkgs/applications/science/molecular-dynamics/gromacs/default.nix b/pkgs/applications/science/molecular-dynamics/gromacs/default.nix index a47dff4e3e87..aa24fa6a5d38 100644 --- a/pkgs/applications/science/molecular-dynamics/gromacs/default.nix +++ b/pkgs/applications/science/molecular-dynamics/gromacs/default.nix @@ -1,7 +1,8 @@ { lib, stdenv, fetchurl, cmake, hwloc, fftw, perl, blas, lapack, mpi, cudatoolkit , singlePrec ? true +, config , enableMpi ? false -, enableCuda ? false +, enableCuda ? config.cudaSupport , cpuAcceleration ? null }: diff --git a/pkgs/development/compilers/cudatoolkit/common.nix b/pkgs/development/compilers/cudatoolkit/common.nix index 2e15012452a8..a6769ee84b6f 100644 --- a/pkgs/development/compilers/cudatoolkit/common.nix +++ b/pkgs/development/compilers/cudatoolkit/common.nix @@ -129,7 +129,7 @@ backendStdenv.mkDerivation rec { (lib.getLib libtiff) qt6Packages.qtwayland rdma-core - ucx + (ucx.override { enableCuda = false; }) # Avoid infinite recursion xorg.libxshmfence xorg.libxkbfile ] ++ (lib.optionals (lib.versionAtLeast version "12.1") (map lib.getLib ([ diff --git a/pkgs/development/libraries/arrayfire/default.nix b/pkgs/development/libraries/arrayfire/default.nix index 8692aa3017f7..2c1caf0bbb2b 100644 --- a/pkgs/development/libraries/arrayfire/default.nix +++ b/pkgs/development/libraries/arrayfire/default.nix @@ -19,7 +19,8 @@ , clblas , doxygen , buildDocs ? false -, cudaSupport ? false +, config +, cudaSupport ? config.cudaSupport , cudatoolkit , darwin }: diff --git a/pkgs/development/libraries/elpa/default.nix b/pkgs/development/libraries/elpa/default.nix index 65e83437f6ba..ec108adc61eb 100644 --- a/pkgs/development/libraries/elpa/default.nix +++ b/pkgs/development/libraries/elpa/default.nix @@ -4,10 +4,11 @@ , avxSupport ? stdenv.hostPlatform.avxSupport , avx2Support ? stdenv.hostPlatform.avx2Support , avx512Support ? stdenv.hostPlatform.avx512Support +, config # Enable NIVIA GPU support # Note, that this needs to be built on a system with a GPU # present for the tests to succeed. -, enableCuda ? false +, enableCuda ? config.cudaSupport # type of GPU architecture , nvidiaArch ? "sm_60" , cudatoolkit diff --git a/pkgs/development/libraries/frei0r/default.nix b/pkgs/development/libraries/frei0r/default.nix index dbf5b9c2373e..0215b82a828c 100644 --- a/pkgs/development/libraries/frei0r/default.nix +++ b/pkgs/development/libraries/frei0r/default.nix @@ -7,7 +7,7 @@ , opencv , pcre , pkg-config -, cudaSupport ? config.cudaSupport or false +, cudaSupport ? config.cudaSupport , cudaPackages }: diff --git a/pkgs/development/libraries/hwloc/default.nix b/pkgs/development/libraries/hwloc/default.nix index fbef44bf67ea..b0c632b69c03 100644 --- a/pkgs/development/libraries/hwloc/default.nix +++ b/pkgs/development/libraries/hwloc/default.nix @@ -2,7 +2,8 @@ , x11Support ? false , libX11 , cairo -, enableCuda ? false +, config +, enableCuda ? config.cudaSupport , cudaPackages }: diff --git a/pkgs/development/libraries/librealsense/default.nix b/pkgs/development/libraries/librealsense/default.nix index cfe7fb89bd56..aec9cfaaf91a 100644 --- a/pkgs/development/libraries/librealsense/default.nix +++ b/pkgs/development/libraries/librealsense/default.nix @@ -13,7 +13,7 @@ , glfw , libGLU , curl -, cudaSupport ? config.cudaSupport or false, cudaPackages ? {} +, cudaSupport ? config.cudaSupport, cudaPackages ? { } , enablePython ? false, pythonPackages ? null , enableGUI ? false, }: diff --git a/pkgs/development/libraries/lightgbm/default.nix b/pkgs/development/libraries/lightgbm/default.nix index 7ac716b326dd..25cb21a314ce 100644 --- a/pkgs/development/libraries/lightgbm/default.nix +++ b/pkgs/development/libraries/lightgbm/default.nix @@ -1,5 +1,5 @@ { config, stdenv, lib, fetchFromGitHub, cmake, gtest, doCheck ? true -, cudaSupport ? config.cudaSupport or false, openclSupport ? false, mpiSupport ? false, javaWrapper ? false, hdfsSupport ? false +, cudaSupport ? config.cudaSupport, openclSupport ? false, mpiSupport ? false, javaWrapper ? false, hdfsSupport ? false , rLibrary ? false, cudaPackages, opencl-headers, ocl-icd, boost, llvmPackages, openmpi, openjdk, swig, hadoop, R, rPackages }: assert doCheck -> mpiSupport != true; diff --git a/pkgs/development/libraries/mlt/default.nix b/pkgs/development/libraries/mlt/default.nix index 1cd14cbcb565..19b03a24a45a 100644 --- a/pkgs/development/libraries/mlt/default.nix +++ b/pkgs/development/libraries/mlt/default.nix @@ -21,7 +21,7 @@ , sox , vid-stab , darwin -, cudaSupport ? config.cudaSupport or false +, cudaSupport ? config.cudaSupport , cudaPackages ? { } , enableJackrack ? stdenv.isLinux , ladspa-sdk diff --git a/pkgs/development/libraries/nvidia-thrust/default.nix b/pkgs/development/libraries/nvidia-thrust/default.nix index 679b2c61c45a..f68b57f193b7 100644 --- a/pkgs/development/libraries/nvidia-thrust/default.nix +++ b/pkgs/development/libraries/nvidia-thrust/default.nix @@ -8,7 +8,7 @@ , symlinkJoin , tbb , hostSystem ? "CPP" -, deviceSystem ? if config.cudaSupport or false then "CUDA" else "OMP" +, deviceSystem ? if config.cudaSupport then "CUDA" else "OMP" }: # Policy for device_vector diff --git a/pkgs/development/libraries/opencv/3.x.nix b/pkgs/development/libraries/opencv/3.x.nix index 40614f489b51..0188e5e1ae96 100644 --- a/pkgs/development/libraries/opencv/3.x.nix +++ b/pkgs/development/libraries/opencv/3.x.nix @@ -14,7 +14,7 @@ , enableOpenblas ? true, openblas, blas, lapack , enableContrib ? true -, enableCuda ? (config.cudaSupport or false) && +, enableCuda ? config.cudaSupport && stdenv.hostPlatform.isx86_64 , cudaPackages ? { } , enableUnfree ? false diff --git a/pkgs/development/libraries/opencv/4.x.nix b/pkgs/development/libraries/opencv/4.x.nix index 3f120e2558f3..c82f0a0065b6 100644 --- a/pkgs/development/libraries/opencv/4.x.nix +++ b/pkgs/development/libraries/opencv/4.x.nix @@ -37,7 +37,7 @@ , blas , enableContrib ? true -, enableCuda ? (config.cudaSupport or false) && stdenv.hostPlatform.isx86_64 +, enableCuda ? config.cudaSupport && stdenv.hostPlatform.isx86_64 , enableCublas ? enableCuda , enableCudnn ? false # NOTE: CUDNN has a large impact on closure size so we disable it by default , enableCufft ? enableCuda diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix index e9a0fece56fc..937669fc5855 100644 --- a/pkgs/development/libraries/openmpi/default.nix +++ b/pkgs/development/libraries/openmpi/default.nix @@ -1,9 +1,9 @@ { lib, stdenv, fetchurl, gfortran, perl, libnl , rdma-core, zlib, numactl, libevent, hwloc, targetPackages, symlinkJoin , libpsm2, libfabric, pmix, ucx - +, config # Enable CUDA support -, cudaSupport ? false, cudatoolkit +, cudaSupport ? config.cudaSupport, cudatoolkit # Enable the Sun Grid Engine bindings , enableSGE ? false diff --git a/pkgs/development/libraries/opensubdiv/default.nix b/pkgs/development/libraries/opensubdiv/default.nix index 9511f4f56f7e..4cd398e6394a 100644 --- a/pkgs/development/libraries/opensubdiv/default.nix +++ b/pkgs/development/libraries/opensubdiv/default.nix @@ -1,6 +1,6 @@ { config, lib, stdenv, fetchFromGitHub, cmake, pkg-config, xorg, libGLU , libGL, glew, ocl-icd, python3 -, cudaSupport ? config.cudaSupport or false, cudatoolkit +, cudaSupport ? config.cudaSupport, cudatoolkit # For visibility mostly. The whole approach to cuda architectures and capabilities # will be reworked soon. , cudaArch ? "compute_37" diff --git a/pkgs/development/libraries/science/chemistry/openmm/default.nix b/pkgs/development/libraries/science/chemistry/openmm/default.nix index 2ad84249758a..a7c388339de0 100644 --- a/pkgs/development/libraries/science/chemistry/openmm/default.nix +++ b/pkgs/development/libraries/science/chemistry/openmm/default.nix @@ -11,7 +11,8 @@ , enableOpencl ? true , opencl-headers , ocl-icd -, enableCuda ? false +, config +, enableCuda ? config.cudaSupport , cudaPackages , addOpenGLRunpath }: diff --git a/pkgs/development/libraries/science/math/faiss/default.nix b/pkgs/development/libraries/science/math/faiss/default.nix index d67f31375e7d..21e6cbf858cd 100644 --- a/pkgs/development/libraries/science/math/faiss/default.nix +++ b/pkgs/development/libraries/science/math/faiss/default.nix @@ -5,7 +5,7 @@ , stdenv , cmake , cudaPackages ? { } -, cudaSupport ? config.cudaSupport or false +, cudaSupport ? config.cudaSupport , nvidia-thrust , useThrustSourceBuild ? true , pythonSupport ? true diff --git a/pkgs/development/libraries/science/math/suitesparse/4.4.nix b/pkgs/development/libraries/science/math/suitesparse/4.4.nix index 95eeaeb8abf3..cbc24b154656 100644 --- a/pkgs/development/libraries/science/math/suitesparse/4.4.nix +++ b/pkgs/development/libraries/science/math/suitesparse/4.4.nix @@ -1,5 +1,6 @@ { lib, stdenv, fetchurl, gfortran, blas, lapack -, enableCuda ? false, cudatoolkit +, config +, enableCuda ? config.cudaSupport, cudatoolkit }: let diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index 51b55592d42e..67dfef186e7d 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -6,7 +6,8 @@ , fixDarwinDylibNames , gmp , mpfr -, enableCuda ? false +, config +, enableCuda ? config.cudaSupport , cudatoolkit }: diff --git a/pkgs/development/libraries/ucc/default.nix b/pkgs/development/libraries/ucc/default.nix index 56cebc08dccc..e26e6e603f8e 100644 --- a/pkgs/development/libraries/ucc/default.nix +++ b/pkgs/development/libraries/ucc/default.nix @@ -1,5 +1,6 @@ { stdenv, lib, fetchFromGitHub, libtool, automake, autoconf, ucx -, enableCuda ? false +, config +, enableCuda ? config.cudaSupport , cudatoolkit , enableAvx ? stdenv.hostPlatform.avxSupport , enableSse41 ? stdenv.hostPlatform.sse4_1Support diff --git a/pkgs/development/libraries/ucx/default.nix b/pkgs/development/libraries/ucx/default.nix index 1af9a7ce7cb6..4ded9c2860aa 100644 --- a/pkgs/development/libraries/ucx/default.nix +++ b/pkgs/development/libraries/ucx/default.nix @@ -1,6 +1,7 @@ { lib, stdenv, fetchFromGitHub, autoreconfHook, doxygen, numactl , rdma-core, libbfd, libiberty, perl, zlib, symlinkJoin, pkg-config -, enableCuda ? false +, config +, enableCuda ? config.cudaSupport , cudatoolkit , enableRocm ? false , rocm-core, rocm-runtime, rocm-device-libs, hip diff --git a/pkgs/development/libraries/xgboost/default.nix b/pkgs/development/libraries/xgboost/default.nix index 0a404f616b92..31d064c2af6d 100644 --- a/pkgs/development/libraries/xgboost/default.nix +++ b/pkgs/development/libraries/xgboost/default.nix @@ -5,7 +5,7 @@ , cmake , gtest , doCheck ? true -, cudaSupport ? config.cudaSupport or false +, cudaSupport ? config.cudaSupport , ncclSupport ? false , rLibrary ? false , cudaPackages diff --git a/pkgs/development/python-modules/chainer/default.nix b/pkgs/development/python-modules/chainer/default.nix index c6793137ba24..1f5be76e2d21 100644 --- a/pkgs/development/python-modules/chainer/default.nix +++ b/pkgs/development/python-modules/chainer/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , config -, cudaSupport ? config.cudaSupport or false +, cudaSupport ? config.cudaSupport , cupy , fetchFromGitHub , filelock diff --git a/pkgs/development/python-modules/jaxlib/bin.nix b/pkgs/development/python-modules/jaxlib/bin.nix index c7e84e4c11a2..b3d3138ab443 100644 --- a/pkgs/development/python-modules/jaxlib/bin.nix +++ b/pkgs/development/python-modules/jaxlib/bin.nix @@ -27,7 +27,7 @@ , scipy , stdenv # Options: -, cudaSupport ? config.cudaSupport or false +, cudaSupport ? config.cudaSupport , cudaPackages ? {} }: diff --git a/pkgs/development/python-modules/jaxlib/default.nix b/pkgs/development/python-modules/jaxlib/default.nix index 2bcf5e9c17c3..bf93bf1a5a26 100644 --- a/pkgs/development/python-modules/jaxlib/default.nix +++ b/pkgs/development/python-modules/jaxlib/default.nix @@ -40,8 +40,9 @@ , snappy , zlib +, config # CUDA flags: -, cudaSupport ? false +, cudaSupport ? config.cudaSupport , cudaPackages ? {} # MKL: diff --git a/pkgs/development/python-modules/libgpuarray/default.nix b/pkgs/development/python-modules/libgpuarray/default.nix index 6b141af3c96d..699bbabdfc76 100644 --- a/pkgs/development/python-modules/libgpuarray/default.nix +++ b/pkgs/development/python-modules/libgpuarray/default.nix @@ -9,7 +9,9 @@ , six , nose , mako -, cudaSupport ? false, cudaPackages +, config +, cudaSupport ? config.cudaSupport +, cudaPackages ? { } , openclSupport ? true, ocl-icd, clblas }: diff --git a/pkgs/development/python-modules/numba/default.nix b/pkgs/development/python-modules/numba/default.nix index fae84969a661..d503307ce67a 100644 --- a/pkgs/development/python-modules/numba/default.nix +++ b/pkgs/development/python-modules/numba/default.nix @@ -14,12 +14,14 @@ , runCommand , fetchpatch +, config + # CUDA-only dependencies: , addOpenGLRunpath ? null , cudaPackages ? {} # CUDA flags: -, cudaSupport ? false +, cudaSupport ? config.cudaSupport }: let diff --git a/pkgs/development/python-modules/tensorflow/bin.nix b/pkgs/development/python-modules/tensorflow/bin.nix index 5bb668965048..fbedcae3cc56 100644 --- a/pkgs/development/python-modules/tensorflow/bin.nix +++ b/pkgs/development/python-modules/tensorflow/bin.nix @@ -21,7 +21,8 @@ , backports_weakref , tensorflow-estimator-bin , tensorboard -, cudaSupport ? false +, config +, cudaSupport ? config.cudaSupport , cudaPackages ? {} , zlib , python diff --git a/pkgs/development/python-modules/tensorflow/default.nix b/pkgs/development/python-modules/tensorflow/default.nix index ba7c36c9503c..d95678f7fc6b 100644 --- a/pkgs/development/python-modules/tensorflow/default.nix +++ b/pkgs/development/python-modules/tensorflow/default.nix @@ -17,7 +17,8 @@ # that in nix as well. It would make some things easier and less confusing, but # it would also make the default tensorflow package unfree. See # https://groups.google.com/a/tensorflow.org/forum/#!topic/developers/iRCt5m4qUz0 -, cudaSupport ? false +, config +, cudaSupport ? config.cudaSupport , cudaPackages ? { } , cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities , mklSupport ? false, mkl diff --git a/pkgs/development/python-modules/theano/default.nix b/pkgs/development/python-modules/theano/default.nix index 1bcbda650a25..428bf4310d6b 100644 --- a/pkgs/development/python-modules/theano/default.nix +++ b/pkgs/development/python-modules/theano/default.nix @@ -11,8 +11,9 @@ , setuptools , six , libgpuarray -, cudaSupport ? false, cudaPackages ? {} -, cudnnSupport ? false +, config +, cudaSupport ? config.cudaSupport, cudaPackages ? { } +, cudnnSupport ? cudaSupport }: let diff --git a/pkgs/development/python-modules/torch/default.nix b/pkgs/development/python-modules/torch/default.nix index 5e0c56800073..912628bf9497 100644 --- a/pkgs/development/python-modules/torch/default.nix +++ b/pkgs/development/python-modules/torch/default.nix @@ -1,5 +1,5 @@ { stdenv, lib, fetchFromGitHub, buildPythonPackage, python, - cudaSupport ? false, cudaPackages, magma, + config, cudaSupport ? config.cudaSupport, cudaPackages, magma, useSystemNccl ? true, MPISupport ? false, mpi, buildDocs ? false, diff --git a/pkgs/games/katago/default.nix b/pkgs/games/katago/default.nix index cc49d6338a66..0ca0deb518ff 100644 --- a/pkgs/games/katago/default.nix +++ b/pkgs/games/katago/default.nix @@ -1,6 +1,7 @@ { stdenv , boost , cmake +, config , cudaPackages , eigen , fetchFromGitHub @@ -14,7 +15,7 @@ , openssl , writeShellScriptBin , enableAVX2 ? stdenv.hostPlatform.avx2Support -, backend ? "opencl" +, backend ? if config.cudaSupport then "cuda" else "opencl" , enableBigBoards ? false , enableContrib ? false , enableTcmalloc ? true diff --git a/pkgs/servers/sunshine/default.nix b/pkgs/servers/sunshine/default.nix index 300c21f2a879..bf3f4fa30058 100644 --- a/pkgs/servers/sunshine/default.nix +++ b/pkgs/servers/sunshine/default.nix @@ -30,7 +30,8 @@ , svt-av1 , vulkan-loader , libappindicator -, cudaSupport ? false +, config +, cudaSupport ? config.cudaSupport , cudaPackages ? {} }: let diff --git a/pkgs/tools/compression/zfp/default.nix b/pkgs/tools/compression/zfp/default.nix index 2d3890484e79..d63140b14760 100644 --- a/pkgs/tools/compression/zfp/default.nix +++ b/pkgs/tools/compression/zfp/default.nix @@ -1,6 +1,7 @@ { cmake, cudatoolkit, fetchFromGitHub, gfortran, lib, llvmPackages, python3Packages, stdenv +, config , enableCfp ? true -, enableCuda ? false +, enableCuda ? config.cudaSupport , enableFortran ? builtins.elem stdenv.targetPlatform.system gfortran.meta.platforms , enableOpenMP ? true , enablePython ? true diff --git a/pkgs/tools/graphics/waifu2x-converter-cpp/default.nix b/pkgs/tools/graphics/waifu2x-converter-cpp/default.nix index d8cb710b2936..56fe4e122e53 100644 --- a/pkgs/tools/graphics/waifu2x-converter-cpp/default.nix +++ b/pkgs/tools/graphics/waifu2x-converter-cpp/default.nix @@ -1,5 +1,6 @@ { cmake, fetchFromGitHub, makeWrapper, opencv3, lib, stdenv, ocl-icd, opencl-headers, OpenCL -, cudaSupport ? false, cudatoolkit ? null +, config +, cudaSupport ? config.cudaSupport, cudatoolkit ? null }: stdenv.mkDerivation rec { diff --git a/pkgs/tools/security/hashcat/default.nix b/pkgs/tools/security/hashcat/default.nix index dc7676ca764d..0fec2a9ec992 100644 --- a/pkgs/tools/security/hashcat/default.nix +++ b/pkgs/tools/security/hashcat/default.nix @@ -2,7 +2,7 @@ , addOpenGLRunpath , config , cudaPackages ? {} -, cudaSupport ? config.cudaSupport or false +, cudaSupport ? config.cudaSupport , fetchurl , makeWrapper , opencl-headers diff --git a/pkgs/tools/security/truecrack/default.nix b/pkgs/tools/security/truecrack/default.nix index aebbbc79f8f4..c58ce4ae57b1 100644 --- a/pkgs/tools/security/truecrack/default.nix +++ b/pkgs/tools/security/truecrack/default.nix @@ -1,5 +1,6 @@ { lib, gccStdenv, fetchFromGitLab, cudatoolkit -, cudaSupport ? false +, config +, cudaSupport ? config.cudaSupport , pkg-config }: gccStdenv.mkDerivation rec { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9d7dac08bf37..1b3c828de6a3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4207,7 +4207,7 @@ with pkgs; libtensorflow = python3.pkgs.tensorflow.libtensorflow; libtorch-bin = callPackage ../development/libraries/science/math/libtorch/bin.nix { - cudaSupport = config.cudaSupport or false; + inherit (config) cudaSupport; }; tensorflow-lite = callPackage ../development/libraries/science/math/tensorflow-lite { }; @@ -10904,7 +10904,7 @@ with pkgs; nvidia-thrust-intel = callPackage ../development/libraries/nvidia-thrust { hostSystem = "TBB"; - deviceSystem = if config.cudaSupport or false then "CUDA" else "TBB"; + deviceSystem = if config.cudaSupport then "CUDA" else "TBB"; }; nvidia-thrust-cuda = callPackage ../development/libraries/nvidia-thrust { @@ -15169,7 +15169,7 @@ with pkgs; colm = callPackage ../development/compilers/colm { }; - colmap = libsForQt5.callPackage ../applications/science/misc/colmap { cudaSupport = config.cudaSupport or false; }; + colmap = libsForQt5.callPackage ../applications/science/misc/colmap { inherit (config) cudaSupport; }; colmapWithCuda = colmap.override { cudaSupport = true; }; chickenPackages_4 = callPackage ../development/compilers/chicken/4 { }; @@ -39361,7 +39361,7 @@ with pkgs; ### SCIENCE / MATH caffe = callPackage ../applications/science/math/caffe ({ - cudaSupport = config.cudaSupport or false; + inherit (config) cudaSupport; cudaPackages = cudaPackages_10_1; opencv3 = opencv3WithoutCuda; # Used only for image loading. blas = openblas; @@ -39376,7 +39376,7 @@ with pkgs; stdenv = gcc7Stdenv; inherit (linuxPackages) nvidia_x11; opencv3 = opencv3WithoutCuda; # Used only for image loading. - cudaSupport = config.cudaSupport or false; + inherit (config) cudaSupport; }; dap = callPackage ../applications/science/math/dap { }; diff --git a/pkgs/top-level/config.nix b/pkgs/top-level/config.nix index 42053ce95de7..5e25231d957c 100644 --- a/pkgs/top-level/config.nix +++ b/pkgs/top-level/config.nix @@ -117,6 +117,12 @@ let ''; }; + cudaSupport = mkMassRebuild { + type = types.bool; + default = false; + feature = "build packages with CUDA support by default"; + }; + showDerivationWarnings = mkOption { type = types.listOf (types.enum [ "maintainerless" ]); default = []; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7226140d890b..7344b930e6c4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1820,7 +1820,7 @@ self: super: with self; { chai = callPackage ../development/python-modules/chai { }; chainer = callPackage ../development/python-modules/chainer { - cudaSupport = pkgs.config.cudaSupport or false; + inherit (pkgs.config) cudaSupport; }; chainmap = callPackage ../development/python-modules/chainmap { }; @@ -5290,13 +5290,13 @@ self: super: with self; { jax-jumpy = callPackage ../development/python-modules/jax-jumpy { }; jaxlib-bin = callPackage ../development/python-modules/jaxlib/bin.nix { - cudaSupport = pkgs.config.cudaSupport or false; + inherit (pkgs.config) cudaSupport; }; jaxlib-build = callPackage ../development/python-modules/jaxlib rec { inherit (pkgs.darwin) cctools; # Some platforms don't have `cudaSupport` defined, hence the need for 'or false'. - cudaSupport = pkgs.config.cudaSupport or false; + inherit (pkgs.config) cudaSupport; IOKit = pkgs.darwin.apple_sdk_11_0.IOKit; protobuf = pkgs.protobuf3_20; # jaxlib-build 0.3.15 won't build with protobuf 3.21 }; @@ -5841,7 +5841,7 @@ self: super: with self; { libgpuarray = callPackage ../development/python-modules/libgpuarray { clblas = pkgs.clblas.override { inherit (self) boost; }; - cudaSupport = pkgs.config.cudaSupport or false; + inherit (pkgs.config) cudaSupport; }; libiio = (toPythonModule (pkgs.libiio.override { inherit python; })).python; @@ -7156,7 +7156,7 @@ self: super: with self; { num2words = callPackage ../development/python-modules/num2words { }; numba = callPackage ../development/python-modules/numba { - cudaSupport = pkgs.config.cudaSupport or false; + inherit (pkgs.config) cudaSupport; }; numbaWithCuda = self.numba.override { @@ -7324,7 +7324,7 @@ self: super: with self; { openai-triton-bin = callPackage ../development/python-modules/openai-triton/bin.nix { }; openai-whisper = callPackage ../development/python-modules/openai-whisper { - cudaSupport = pkgs.config.cudaSupport or false; + inherit (pkgs.config) cudaSupport; }; openant = callPackage ../development/python-modules/openant { }; @@ -12371,12 +12371,12 @@ self: super: with self; { tensorboardx = callPackage ../development/python-modules/tensorboardx { }; tensorflow-bin = callPackage ../development/python-modules/tensorflow/bin.nix { - cudaSupport = pkgs.config.cudaSupport or false; + inherit (pkgs.config) cudaSupport; }; tensorflow-build = callPackage ../development/python-modules/tensorflow { inherit (pkgs.darwin) cctools; - cudaSupport = pkgs.config.cudaSupport or false; + inherit (pkgs.config) cudaSupport; inherit (self.tensorflow-bin) cudaPackages; inherit (pkgs.darwin.apple_sdk.frameworks) Foundation Security; flatbuffers-core = pkgs.flatbuffers; @@ -12495,7 +12495,7 @@ self: super: with self; { theano-pymc = callPackage ../development/python-modules/theano-pymc { }; theano = callPackage ../development/python-modules/theano rec { - cudaSupport = pkgs.config.cudaSupport or false; + inherit (pkgs.config) cudaSupport; cudnnSupport = cudaSupport; }; @@ -12662,9 +12662,9 @@ self: super: with self; { toposort = callPackage ../development/python-modules/toposort { }; torch = callPackage ../development/python-modules/torch { - cudaSupport = pkgs.config.cudaSupport or false; + inherit (pkgs.config) cudaSupport; magma = - if pkgs.config.cudaSupport or false + if pkgs.config.cudaSupport then pkgs.magma-cuda-static else pkgs.magma; inherit (pkgs.darwin.apple_sdk.frameworks) Accelerate CoreServices;