Skip to content
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
2 changes: 1 addition & 1 deletion pkgs/by-name/ca/catboost/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ stdenv.mkDerivation (finalAttrs: {
shopt -s globstar
for cmakelists in **/CMakeLists.*; do
sed -i "s/OpenSSL::OpenSSL/OpenSSL::SSL/g" $cmakelists
${lib.optionalString (lib.versionOlder cudaPackages.cudaVersion "11.8") ''
${lib.optionalString (cudaPackages.cudaOlder "11.8") ''
sed -i 's/-gencode=arch=compute_89,code=sm_89//g' $cmakelists
sed -i 's/-gencode=arch=compute_90,code=sm_90//g' $cmakelists
''}
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/ti/tiny-cuda-nn/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}:
let
inherit (lib) lists strings;
inherit (cudaPackages) backendStdenv cudaVersion flags;
inherit (cudaPackages) backendStdenv cudaAtLeast flags;

cuda-common-redist = with cudaPackages; [
(lib.getDev cuda_cudart) # cuda_runtime.h
Expand Down Expand Up @@ -62,7 +62,7 @@ stdenv.mkDerivation (finalAttrs: {

# Remove this once a release is made with
# https://github.com/NVlabs/tiny-cuda-nn/commit/78a14fe8c292a69f54e6d0d47a09f52b777127e1
postPatch = lib.optionals (strings.versionAtLeast cudaVersion "11.0") ''
postPatch = lib.optionals (cudaAtLeast "11.0") ''
substituteInPlace bindings/torch/setup.py --replace-fail \
"-std=c++14" "-std=c++17"
'';
Expand Down
14 changes: 8 additions & 6 deletions pkgs/development/cuda-modules/aliases.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Packages which have been deprecated or removed from cudaPackages
final: prev:
final: _:
let
inherit (prev.lib) warn;
inherit (builtins) mapAttrs;

mkRenamed =
oldName:
{ path, package }:
warn "cudaPackages.${oldName} is deprecated, use ${path} instead" package;
final.lib.warn "cudaPackages.${oldName} is deprecated, use ${path} instead" package;
in
mapAttrs mkRenamed {
builtins.mapAttrs mkRenamed {
# A comment to prevent empty { } from collapsing into a single line

cudaVersion = {
path = "cudaPackages.cudaMajorMinorVersion";
package = final.cudaMajorMinorVersion;
};
}
7 changes: 3 additions & 4 deletions pkgs/development/cuda-modules/cuda-samples/extension.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
cudaVersion,
cudaMajorMinorVersion,
lib,
stdenv,
}:
Expand Down Expand Up @@ -27,7 +27,7 @@ let

# Samples are built around the CUDA Toolkit, which is not available for
# aarch64. Check for both CUDA version and platform.
cudaVersionIsSupported = cudaVersionToHash ? ${cudaVersion};
cudaVersionIsSupported = cudaVersionToHash ? ${cudaMajorMinorVersion};
platformIsSupported = hostPlatform.isx86_64;
isSupported = cudaVersionIsSupported && platformIsSupported;

Expand All @@ -36,8 +36,7 @@ let
final: _:
lib.attrsets.optionalAttrs isSupported {
cuda-samples = final.callPackage ./generic.nix {
inherit cudaVersion;
hash = cudaVersionToHash.${cudaVersion};
hash = cudaVersionToHash.${cudaMajorMinorVersion};
};
};
in
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/cuda-modules/cuda-samples/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
backendStdenv,
cmake,
cudatoolkit,
cudaVersion,
cudaMajorMinorVersion,
fetchFromGitHub,
fetchpatch,
freeimage,
Expand All @@ -20,7 +20,7 @@ backendStdenv.mkDerivation (finalAttrs: {
strictDeps = true;

pname = "cuda-samples";
version = cudaVersion;
version = cudaMajorMinorVersion;

src = fetchFromGitHub {
owner = "NVIDIA";
Expand Down
6 changes: 3 additions & 3 deletions pkgs/development/cuda-modules/cuda/extension.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ cudaVersion, lib }:
{ cudaMajorMinorVersion, lib }:
let
inherit (lib) attrsets modules trivial;
redistName = "cuda";
Expand All @@ -23,10 +23,10 @@ let
};

# Check if the current CUDA version is supported.
cudaVersionMappingExists = builtins.hasAttr cudaVersion cudaVersionMap;
cudaVersionMappingExists = builtins.hasAttr cudaMajorMinorVersion cudaVersionMap;

# fullCudaVersion : String
fullCudaVersion = cudaVersionMap.${cudaVersion};
fullCudaVersion = cudaVersionMap.${cudaMajorMinorVersion};

evaluatedModules = modules.evalModules {
modules = [
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/cuda-modules/cudatoolkit/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
cudaVersion,
cudaMajorMinorVersion,
runPatches ? [ ],
autoPatchelfHook,
autoAddDriverRunpath,
Expand Down Expand Up @@ -54,7 +54,7 @@
let
# Version info for the classic cudatoolkit packages that contain everything that is in redist.
releases = builtins.import ./releases.nix;
release = releases.${cudaVersion};
release = releases.${cudaMajorMinorVersion};
in

backendStdenv.mkDerivation rec {
Expand Down
6 changes: 3 additions & 3 deletions pkgs/development/cuda-modules/cudatoolkit/redist-wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
backendStdenv,
cudaOlder,
cudatoolkit-legacy-runfile,
cudaVersion,
cudaMajorMinorVersion,
cuda_cccl ? null,
cuda_cudart ? null,
cuda_cuobjdump ? null,
Expand Down Expand Up @@ -66,8 +66,8 @@ if cudaOlder "11.4" then
cudatoolkit-legacy-runfile
else
symlinkJoin rec {
name = "cuda-merged-${cudaVersion}";
version = cudaVersion;
name = "cuda-merged-${cudaMajorMinorVersion}";
version = cudaMajorMinorVersion;

paths = builtins.concatMap getAllOutputs allPackages;

Expand Down
11 changes: 1 addition & 10 deletions pkgs/development/cuda-modules/cusparselt/extension.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
lib,
stdenv,
cudaVersion,
cudaMajorMinorVersion,
flags,
mkVersionedPackageName,
}:
Expand Down Expand Up @@ -54,15 +54,6 @@ let
releaseGrabber
]) cusparseltVersions;

# Our cudaVersion tells us which version of CUDA we're building against.
# The subdirectories in lib/ tell us which versions of CUDA are supported.
# Typically the names will look like this:
#
# - 10.2
# - 11
# - 11.0
# - 12

# A release is supported if it has a libPath that matches our CUDA version for our platform.
# LibPath are not constant across the same release -- one platform may support fewer
# CUDA versions than another.
Expand Down
9 changes: 4 additions & 5 deletions pkgs/development/cuda-modules/cutensor/extension.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# - Instead of providing different releases for each version of CUDA, CuTensor has multiple subdirectories in `lib`
# -- one for each version of CUDA.
{
cudaVersion,
cudaMajorMinorVersion,
flags,
lib,
mkVersionedPackageName,
Expand Down Expand Up @@ -73,7 +73,7 @@ let
releaseGrabber
]) cutensorVersions;

# Our cudaVersion tells us which version of CUDA we're building against.
# Our cudaMajorMinorVersion tells us which version of CUDA we're building against.
# The subdirectories in lib/ tell us which versions of CUDA are supported.
# Typically the names will look like this:
#
Expand All @@ -85,10 +85,9 @@ let
# libPath :: String
libPath =
let
cudaMajorMinor = versions.majorMinor cudaVersion;
cudaMajor = versions.major cudaVersion;
cudaMajorVersion = versions.major cudaMajorMinorVersion;
in
if cudaMajorMinor == "10.2" then cudaMajorMinor else cudaMajor;
if cudaMajorMinorVersion == "10.2" then cudaMajorMinorVersion else cudaMajorVersion;

# A release is supported if it has a libPath that matches our CUDA version for our platform.
# LibPath are not constant across the same release -- one platform may support fewer
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/cuda-modules/fixups/cudnn.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
cudaOlder,
cudatoolkit,
cudaVersion,
cudaMajorMinorVersion,
fetchurl,
lib,
libcublas ? null, # cuDNN uses CUDA Toolkit on old releases, where libcublas is not available.
Expand All @@ -25,7 +25,7 @@ finalAttrs: prevAttrs: {
cudaTooOld = cudaOlder finalAttrs.passthru.featureRelease.minCudaVersion;
cudaTooNew =
(finalAttrs.passthru.featureRelease.maxCudaVersion != null)
&& strings.versionOlder finalAttrs.passthru.featureRelease.maxCudaVersion cudaVersion;
&& strings.versionOlder finalAttrs.passthru.featureRelease.maxCudaVersion cudaMajorMinorVersion;
in
prevAttrs.badPlatformsConditions or { }
// {
Expand Down
8 changes: 4 additions & 4 deletions pkgs/development/cuda-modules/fixups/tensorrt.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
cudaOlder,
cudaPackages,
cudaVersion,
cudaMajorMinorVersion,
lib,
mkVersionedPackageName,
patchelf,
Expand Down Expand Up @@ -30,7 +30,7 @@ finalAttrs: prevAttrs: {
cudaTooOld = cudaOlder finalAttrs.passthru.featureRelease.minCudaVersion;
cudaTooNew =
(finalAttrs.passthru.featureRelease.maxCudaVersion != null)
&& strings.versionOlder finalAttrs.passthru.featureRelease.maxCudaVersion cudaVersion;
&& strings.versionOlder finalAttrs.passthru.featureRelease.maxCudaVersion cudaMajorMinorVersion;
cudnnVersionIsSpecified = finalAttrs.passthru.featureRelease.cudnnVersion != null;
cudnnVersionSpecified = versions.majorMinor finalAttrs.passthru.featureRelease.cudnnVersion;
cudnnVersionProvided = versions.majorMinor finalAttrs.passthru.cudnn.version;
Expand All @@ -52,7 +52,7 @@ finalAttrs: prevAttrs: {
inherit (finalAttrs.passthru.redistribRelease) hash;
message = ''
To use the TensorRT derivation, you must join the NVIDIA Developer Program and
download the ${finalAttrs.version} TAR package for CUDA ${cudaVersion} from
download the ${finalAttrs.version} TAR package for CUDA ${cudaMajorMinorVersion} from
${finalAttrs.meta.homepage}.

Once you have downloaded the file, add it to the store with the following
Expand Down Expand Up @@ -96,7 +96,7 @@ finalAttrs: prevAttrs: {
'';

passthru = prevAttrs.passthru or { } // {
useCudatoolkitRunfile = strings.versionOlder cudaVersion "11.3.999";
useCudatoolkitRunfile = strings.versionOlder cudaMajorMinorVersion "11.3.999";
# The CUDNN used with TensorRT.
# If null, the default cudnn derivation will be used.
# If a version is specified, the cudnn derivation with that version will be used,
Expand Down
22 changes: 12 additions & 10 deletions pkgs/development/cuda-modules/flags.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cudaCapabilities ? (config.cudaCapabilities or [ ]),
cudaForwardCompat ? (config.cudaForwardCompat or true),
lib,
cudaVersion,
cudaMajorMinorVersion,
stdenv,
# gpus :: List Gpu
gpus,
Expand Down Expand Up @@ -44,9 +44,9 @@ let
gpu:
let
inherit (gpu) minCudaVersion maxCudaVersion;
lowerBoundSatisfied = strings.versionAtLeast cudaVersion minCudaVersion;
lowerBoundSatisfied = strings.versionAtLeast cudaMajorMinorVersion minCudaVersion;
upperBoundSatisfied =
(maxCudaVersion == null) || !(strings.versionOlder maxCudaVersion cudaVersion);
(maxCudaVersion == null) || !(strings.versionOlder maxCudaVersion cudaMajorMinorVersion);
in
lowerBoundSatisfied && upperBoundSatisfied;

Expand All @@ -57,7 +57,7 @@ let
let
inherit (gpu) dontDefaultAfter isJetson;
newGpu = dontDefaultAfter == null;
recentGpu = newGpu || strings.versionAtLeast dontDefaultAfter cudaVersion;
recentGpu = newGpu || strings.versionAtLeast dontDefaultAfter cudaMajorMinorVersion;
in
recentGpu && !isJetson;

Expand Down Expand Up @@ -289,12 +289,14 @@ assert
};
actualWrapped = (builtins.tryEval (builtins.deepSeq actual actual)).value;
in
asserts.assertMsg ((strings.versionAtLeast cudaVersion "11.2") -> (expected == actualWrapped)) ''
This test should only fail when using a version of CUDA older than 11.2, the first to support
8.6.
Expected: ${builtins.toJSON expected}
Actual: ${builtins.toJSON actualWrapped}
'';
asserts.assertMsg
((strings.versionAtLeast cudaMajorMinorVersion "11.2") -> (expected == actualWrapped))
''
This test should only fail when using a version of CUDA older than 11.2, the first to support
8.6.
Expected: ${builtins.toJSON expected}
Actual: ${builtins.toJSON actualWrapped}
'';
# Check mixed Jetson and non-Jetson devices
assert
let
Expand Down
6 changes: 3 additions & 3 deletions pkgs/development/cuda-modules/generic-builders/multiplex.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
# callPackage-provided arguments
lib,
cudaVersion,
cudaMajorMinorVersion,
flags,
stdenv,
# Expected to be passed by the caller
Expand Down Expand Up @@ -69,8 +69,8 @@ let
isSupported =
package:
redistArch == package.redistArch
&& strings.versionAtLeast cudaVersion package.minCudaVersion
&& strings.versionAtLeast package.maxCudaVersion cudaVersion;
&& strings.versionAtLeast cudaMajorMinorVersion package.minCudaVersion
&& strings.versionAtLeast package.maxCudaVersion cudaMajorMinorVersion;

# Get all of the packages for our given platform.
# redistArch :: String
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/cuda-modules/packages/backendStdenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# E.g. for cudaPackages_11_8 we use gcc11 with gcc12's libstdc++
# Cf. https://github.com/NixOS/nixpkgs/pull/218265 for context
{
cudaVersion,
cudaMajorMinorVersion,
lib,
nvccCompatibilities,
pkgs,
Expand All @@ -16,7 +16,7 @@
}:

let
gccMajorVersion = nvccCompatibilities.${cudaVersion}.gccMaxMajorVersion;
gccMajorVersion = nvccCompatibilities.${cudaMajorMinorVersion}.gccMaxMajorVersion;
cudaStdenv = stdenvAdapters.useLibsFrom stdenv pkgs."gcc${gccMajorVersion}Stdenv";
passthruExtra = {
# cudaPackages.backendStdenv.nixpkgsCompatibleLibstdcxx has been removed,
Expand Down
17 changes: 9 additions & 8 deletions pkgs/development/cuda-modules/packages/nccl-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ let
cuda_cccl
cuda_cudart
cuda_nvcc
cudaAtLeast
cudaOlder
cudatoolkit
cudaVersion
nccl
;
in
Expand All @@ -43,25 +44,25 @@ backendStdenv.mkDerivation (finalAttrs: {

nativeBuildInputs =
[ which ]
++ lib.optionals (lib.versionOlder cudaVersion "11.4") [ cudatoolkit ]
++ lib.optionals (lib.versionAtLeast cudaVersion "11.4") [ cuda_nvcc ];
++ lib.optionals (cudaOlder "11.4") [ cudatoolkit ]
++ lib.optionals (cudaAtLeast "11.4") [ cuda_nvcc ];

buildInputs =
[ nccl ]
++ lib.optionals (lib.versionOlder cudaVersion "11.4") [ cudatoolkit ]
++ lib.optionals (lib.versionAtLeast cudaVersion "11.4") [
++ lib.optionals (cudaOlder "11.4") [ cudatoolkit ]
++ lib.optionals (cudaAtLeast "11.4") [
cuda_nvcc # crt/host_config.h
cuda_cudart
]
++ lib.optionals (lib.versionAtLeast cudaVersion "12.0") [
++ lib.optionals (cudaAtLeast "12.0") [
cuda_cccl # <nv/target>
]
++ lib.optionals mpiSupport [ mpi ];

makeFlags =
[ "NCCL_HOME=${nccl}" ]
++ lib.optionals (lib.versionOlder cudaVersion "11.4") [ "CUDA_HOME=${cudatoolkit}" ]
++ lib.optionals (lib.versionAtLeast cudaVersion "11.4") [ "CUDA_HOME=${cuda_nvcc}" ]
++ lib.optionals (cudaOlder "11.4") [ "CUDA_HOME=${cudatoolkit}" ]
++ lib.optionals (cudaAtLeast "11.4") [ "CUDA_HOME=${cuda_nvcc}" ]
++ lib.optionals mpiSupport [ "MPI=1" ];

enableParallelBuilding = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/ctranslate2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ stdenv.mkDerivation rec {
hexa
misuzu
];
broken = (lib.versionOlder cudaPackages.cudaVersion "11.4") || !(withCuDNN -> withCUDA);
broken = (cudaPackages.cudaOlder "11.4") || !(withCuDNN -> withCUDA);
};
}
Loading