Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect global config.cudaSupport #224068

Merged
merged 6 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions doc/languages-frameworks/cuda.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/graphics/digikam/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
, breeze-icons
, oxygen

, cudaSupport ? config.cudaSupport or false
, cudaSupport ? config.cudaSupport
, cudaPackages ? {}
}:

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/misc/blender/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/math/caffe/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pkgs/applications/science/math/cntk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
}:

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/math/mathematica/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
, config
, lib
, cudaPackages
, cudaSupport ? config.cudaSupport or false
, cudaSupport ? config.cudaSupport
, lang ? "en"
, webdoc ? false
, version ? null
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/math/mxnet/default.nix
Original file line number Diff line number Diff line change
@@ -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
}:

Expand Down
3 changes: 2 additions & 1 deletion pkgs/applications/science/misc/colmap/default.nix
Original file line number Diff line number Diff line change
@@ -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 != { };

Expand Down
Original file line number Diff line number Diff line change
@@ -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
}:

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/cudatoolkit/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ([
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/libraries/arrayfire/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
, clblas
, doxygen
, buildDocs ? false
, cudaSupport ? false
, config
, cudaSupport ? config.cudaSupport
, cudatoolkit
, darwin
}:
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/libraries/elpa/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/frei0r/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
, opencv
, pcre
, pkg-config
, cudaSupport ? config.cudaSupport or false
, cudaSupport ? config.cudaSupport
, cudaPackages
}:

Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/libraries/hwloc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
, x11Support ? false
, libX11
, cairo
, enableCuda ? false
, config
, enableCuda ? config.cudaSupport
, cudaPackages
}:

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/librealsense/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
, glfw
, libGLU
, curl
, cudaSupport ? config.cudaSupport or false, cudaPackages ? {}
, cudaSupport ? config.cudaSupport, cudaPackages ? { }
, enablePython ? false, pythonPackages ? null
, enableGUI ? false,
}:
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/lightgbm/default.nix
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/mlt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
, sox
, vid-stab
, darwin
, cudaSupport ? config.cudaSupport or false
, cudaSupport ? config.cudaSupport
, cudaPackages ? { }
, enableJackrack ? stdenv.isLinux
, ladspa-sdk
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/nvidia-thrust/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/opencv/3.x.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/opencv/4.x.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/openmpi/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/opensubdiv/default.nix
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
, enableOpencl ? true
, opencl-headers
, ocl-icd
, enableCuda ? false
, config
, enableCuda ? config.cudaSupport
, cudaPackages
, addOpenGLRunpath
}:
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/science/math/faiss/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
, stdenv
, cmake
, cudaPackages ? { }
, cudaSupport ? config.cudaSupport or false
, cudaSupport ? config.cudaSupport
, nvidia-thrust
, useThrustSourceBuild ? true
, pythonSupport ? true
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/libraries/science/math/suitesparse/4.4.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ lib, stdenv, fetchurl, gfortran, blas, lapack
, enableCuda ? false, cudatoolkit
, config
, enableCuda ? config.cudaSupport, cudatoolkit
}:

let
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
, fixDarwinDylibNames
, gmp
, mpfr
, enableCuda ? false
, config
, enableCuda ? config.cudaSupport
, cudatoolkit
}:

Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/libraries/ucc/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/libraries/ucx/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/xgboost/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
, cmake
, gtest
, doCheck ? true
, cudaSupport ? config.cudaSupport or false
, cudaSupport ? config.cudaSupport
, ncclSupport ? false
, rLibrary ? false
, cudaPackages
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/python-modules/chainer/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib
, buildPythonPackage
, config
, cudaSupport ? config.cudaSupport or false
, cudaSupport ? config.cudaSupport
, cupy
, fetchFromGitHub
, filelock
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/python-modules/jaxlib/bin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
, scipy
, stdenv
# Options:
, cudaSupport ? config.cudaSupport or false
, cudaSupport ? config.cudaSupport
, cudaPackages ? {}
}:

Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/python-modules/jaxlib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@
, snappy
, zlib

, config
# CUDA flags:
, cudaSupport ? false
, cudaSupport ? config.cudaSupport
, cudaPackages ? {}

# MKL:
Expand Down
4 changes: 3 additions & 1 deletion pkgs/development/python-modules/libgpuarray/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
, six
, nose
, mako
, cudaSupport ? false, cudaPackages
, config
, cudaSupport ? config.cudaSupport
, cudaPackages ? { }
, openclSupport ? true, ocl-icd, clblas
}:

Expand Down
4 changes: 3 additions & 1 deletion pkgs/development/python-modules/numba/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
, runCommand
, fetchpatch

, config

# CUDA-only dependencies:
, addOpenGLRunpath ? null
, cudaPackages ? {}

# CUDA flags:
, cudaSupport ? false
, cudaSupport ? config.cudaSupport
}:

let
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/python-modules/tensorflow/bin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
, backports_weakref
, tensorflow-estimator-bin
, tensorboard
, cudaSupport ? false
, config
, cudaSupport ? config.cudaSupport
, cudaPackages ? {}
, zlib
, python
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/python-modules/tensorflow/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions pkgs/development/python-modules/theano/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
, setuptools
, six
, libgpuarray
, cudaSupport ? false, cudaPackages ? {}
, cudnnSupport ? false
, config
, cudaSupport ? config.cudaSupport, cudaPackages ? { }
, cudnnSupport ? cudaSupport
}:

let
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/python-modules/torch/default.nix
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 2 additions & 1 deletion pkgs/games/katago/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ stdenv
, boost
, cmake
, config
, cudaPackages
, eigen
, fetchFromGitHub
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pkgs/servers/sunshine/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
, svt-av1
, vulkan-loader
, libappindicator
, cudaSupport ? false
, config
, cudaSupport ? config.cudaSupport
, cudaPackages ? {}
}:
let
Expand Down
Loading