mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
cudaPackages: switch to cudaLib
Signed-off-by: Connor Baker <ConnorBaker01@gmail.com>
This commit is contained in:
parent
629ae4e42c
commit
c5dad2886a
17 changed files with 186 additions and 884 deletions
|
@ -115,8 +115,8 @@ All new projects should use the CUDA redistributables available in [`cudaPackage
|
||||||
|
|
||||||
### Updating supported compilers and GPUs {#updating-supported-compilers-and-gpus}
|
### Updating supported compilers and GPUs {#updating-supported-compilers-and-gpus}
|
||||||
|
|
||||||
1. Update `nvcc-compatibilities.nix` in `pkgs/development/cuda-modules/` to include the newest release of NVCC, as well as any newly supported host compilers.
|
1. Update `nvccCompatibilities` in `pkgs/development/cuda-modules/lib/data/nvcc.nix` to include the newest release of NVCC, as well as any newly supported host compilers.
|
||||||
2. Update `gpus.nix` in `pkgs/development/cuda-modules/` to include any new GPUs supported by the new release of CUDA.
|
2. Update `cudaCapabilityToInfo` in `pkgs/development/cuda-modules/lib/data/cuda.nix` to include any new GPUs supported by the new release of CUDA.
|
||||||
|
|
||||||
### Updating the CUDA Toolkit runfile installer {#updating-the-cuda-toolkit}
|
### Updating the CUDA Toolkit runfile installer {#updating-the-cuda-toolkit}
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,6 @@ scope. These are typically required for the creation of the finalized
|
||||||
|
|
||||||
- `backend-stdenv.nix`: Standard environment for CUDA packages.
|
- `backend-stdenv.nix`: Standard environment for CUDA packages.
|
||||||
- `flags.nix`: Flags set, or consumed by, NVCC in order to build packages.
|
- `flags.nix`: Flags set, or consumed by, NVCC in order to build packages.
|
||||||
- `gpus.nix`: A list of supported NVIDIA GPUs.
|
|
||||||
- `nvcc-compatibilities.nix`: NVCC releases and the version range of GCC/Clang
|
|
||||||
they support.
|
|
||||||
|
|
||||||
## Top-level directories
|
## Top-level directories
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
# Packages which have been deprecated or removed from cudaPackages
|
# Packages which have been deprecated or removed from cudaPackages
|
||||||
final: _:
|
{ lib }:
|
||||||
let
|
let
|
||||||
mkRenamed =
|
mkRenamed =
|
||||||
oldName:
|
oldName:
|
||||||
{ path, package }:
|
{ path, package }:
|
||||||
final.lib.warn "cudaPackages.${oldName} is deprecated, use ${path} instead" package;
|
lib.warn "cudaPackages.${oldName} is deprecated, use ${path} instead" package;
|
||||||
in
|
in
|
||||||
|
final: _:
|
||||||
builtins.mapAttrs mkRenamed {
|
builtins.mapAttrs mkRenamed {
|
||||||
# A comment to prevent empty { } from collapsing into a single line
|
# A comment to prevent empty { } from collapsing into a single line
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# Generally we prefer to do things involving getting attribute names with feature_manifest instead
|
# Generally we prefer to do things involving getting attribute names with feature_manifest instead
|
||||||
# of redistrib_manifest because the feature manifest will have *only* the redist architecture
|
# of redistrib_manifest because the feature manifest will have *only* the redist system
|
||||||
# names as the keys, whereas the redistrib manifest will also have things like version, name, license,
|
# names as the keys, whereas the redistrib manifest will also have things like version, name, license,
|
||||||
# and license_path.
|
# and license_path.
|
||||||
featureManifest = evaluatedModules.config.cuda.manifests.feature;
|
featureManifest = evaluatedModules.config.cuda.manifests.feature;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
|
# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
|
||||||
{
|
{
|
||||||
package,
|
package,
|
||||||
# redistArch :: String
|
# redistSystem :: String
|
||||||
# String is "unsupported" if the given architecture is unsupported.
|
# String is "unsupported" if the given architecture is unsupported.
|
||||||
redistArch,
|
redistSystem,
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
featureRelease = {
|
featureRelease = {
|
||||||
inherit (package) minCudaVersion maxCudaVersion;
|
inherit (package) minCudaVersion maxCudaVersion;
|
||||||
${redistArch}.outputs = {
|
${redistSystem}.outputs = {
|
||||||
lib = true;
|
lib = true;
|
||||||
static = true;
|
static = true;
|
||||||
dev = true;
|
dev = true;
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
# Support matrix can be found at
|
# Support matrix can be found at
|
||||||
# https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-880/support-matrix/index.html
|
# https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-880/support-matrix/index.html
|
||||||
{
|
{
|
||||||
|
cudaLib,
|
||||||
lib,
|
lib,
|
||||||
stdenv,
|
redistSystem,
|
||||||
cudaMajorMinorVersion,
|
|
||||||
flags,
|
|
||||||
mkVersionedPackageName,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
|
@ -15,8 +13,6 @@ let
|
||||||
trivial
|
trivial
|
||||||
;
|
;
|
||||||
|
|
||||||
inherit (stdenv) hostPlatform;
|
|
||||||
|
|
||||||
redistName = "cusparselt";
|
redistName = "cusparselt";
|
||||||
pname = "libcusparse_lt";
|
pname = "libcusparse_lt";
|
||||||
|
|
||||||
|
@ -54,17 +50,12 @@ let
|
||||||
releaseGrabber
|
releaseGrabber
|
||||||
]) cusparseltVersions;
|
]) cusparseltVersions;
|
||||||
|
|
||||||
# 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.
|
|
||||||
# redistArch :: String
|
|
||||||
redistArch = flags.getRedistArch hostPlatform.system;
|
|
||||||
# platformIsSupported :: Manifests -> Boolean
|
# platformIsSupported :: Manifests -> Boolean
|
||||||
platformIsSupported =
|
platformIsSupported =
|
||||||
{ feature, redistrib, ... }:
|
{ feature, redistrib, ... }:
|
||||||
(attrsets.attrByPath [
|
(attrsets.attrByPath [
|
||||||
pname
|
pname
|
||||||
redistArch
|
redistSystem
|
||||||
] null feature) != null;
|
] null feature) != null;
|
||||||
|
|
||||||
# TODO(@connorbaker): With an auxiliary file keeping track of the CUDA versions each release supports,
|
# TODO(@connorbaker): With an auxiliary file keeping track of the CUDA versions each release supports,
|
||||||
|
@ -77,7 +68,8 @@ let
|
||||||
# Compute versioned attribute name to be used in this package set
|
# Compute versioned attribute name to be used in this package set
|
||||||
# Patch version changes should not break the build, so we only use major and minor
|
# Patch version changes should not break the build, so we only use major and minor
|
||||||
# computeName :: RedistribRelease -> String
|
# computeName :: RedistribRelease -> String
|
||||||
computeName = { version, ... }: mkVersionedPackageName redistName version;
|
computeName =
|
||||||
|
{ version, ... }: cudaLib.utils.mkVersionedName redistName (lib.versions.majorMinor version);
|
||||||
in
|
in
|
||||||
final: _:
|
final: _:
|
||||||
let
|
let
|
||||||
|
|
|
@ -13,11 +13,10 @@
|
||||||
# - Instead of providing different releases for each version of CUDA, CuTensor has multiple subdirectories in `lib`
|
# - Instead of providing different releases for each version of CUDA, CuTensor has multiple subdirectories in `lib`
|
||||||
# -- one for each version of CUDA.
|
# -- one for each version of CUDA.
|
||||||
{
|
{
|
||||||
|
cudaLib,
|
||||||
cudaMajorMinorVersion,
|
cudaMajorMinorVersion,
|
||||||
flags,
|
|
||||||
lib,
|
lib,
|
||||||
mkVersionedPackageName,
|
redistSystem,
|
||||||
stdenv,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
|
@ -28,8 +27,6 @@ let
|
||||||
trivial
|
trivial
|
||||||
;
|
;
|
||||||
|
|
||||||
inherit (stdenv) hostPlatform;
|
|
||||||
|
|
||||||
redistName = "cutensor";
|
redistName = "cutensor";
|
||||||
pname = "libcutensor";
|
pname = "libcutensor";
|
||||||
|
|
||||||
|
@ -92,14 +89,12 @@ let
|
||||||
# A release is supported if it has a libPath that matches our CUDA version for our platform.
|
# 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
|
# LibPath are not constant across the same release -- one platform may support fewer
|
||||||
# CUDA versions than another.
|
# CUDA versions than another.
|
||||||
# redistArch :: String
|
|
||||||
redistArch = flags.getRedistArch hostPlatform.system;
|
|
||||||
# platformIsSupported :: Manifests -> Boolean
|
# platformIsSupported :: Manifests -> Boolean
|
||||||
platformIsSupported =
|
platformIsSupported =
|
||||||
{ feature, redistrib, ... }:
|
{ feature, redistrib, ... }:
|
||||||
(attrsets.attrByPath [
|
(attrsets.attrByPath [
|
||||||
pname
|
pname
|
||||||
redistArch
|
redistSystem
|
||||||
] null feature) != null;
|
] null feature) != null;
|
||||||
|
|
||||||
# TODO(@connorbaker): With an auxiliary file keeping track of the CUDA versions each release supports,
|
# TODO(@connorbaker): With an auxiliary file keeping track of the CUDA versions each release supports,
|
||||||
|
@ -112,7 +107,8 @@ let
|
||||||
# Compute versioned attribute name to be used in this package set
|
# Compute versioned attribute name to be used in this package set
|
||||||
# Patch version changes should not break the build, so we only use major and minor
|
# Patch version changes should not break the build, so we only use major and minor
|
||||||
# computeName :: RedistribRelease -> String
|
# computeName :: RedistribRelease -> String
|
||||||
computeName = { version, ... }: mkVersionedPackageName redistName version;
|
computeName =
|
||||||
|
{ version, ... }: cudaLib.utils.mkVersionedName redistName (lib.versions.majorMinor version);
|
||||||
in
|
in
|
||||||
final: _:
|
final: _:
|
||||||
let
|
let
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
|
cudaLib,
|
||||||
cudaOlder,
|
cudaOlder,
|
||||||
cudaPackages,
|
cudaPackages,
|
||||||
cudaMajorMinorVersion,
|
cudaMajorMinorVersion,
|
||||||
lib,
|
lib,
|
||||||
mkVersionedPackageName,
|
|
||||||
patchelf,
|
patchelf,
|
||||||
requireFile,
|
requireFile,
|
||||||
stdenv,
|
stdenv,
|
||||||
|
@ -103,7 +103,9 @@ finalAttrs: prevAttrs: {
|
||||||
# unless it is not available, in which case the default cudnn derivation will be used.
|
# unless it is not available, in which case the default cudnn derivation will be used.
|
||||||
cudnn =
|
cudnn =
|
||||||
let
|
let
|
||||||
desiredName = mkVersionedPackageName "cudnn" finalAttrs.passthru.featureRelease.cudnnVersion;
|
desiredName = cudaLib.utils.mkVersionedName "cudnn" (
|
||||||
|
lib.versions.majorMinor finalAttrs.passthru.featureRelease.cudnnVersion
|
||||||
|
);
|
||||||
in
|
in
|
||||||
if finalAttrs.passthru.featureRelease.cudnnVersion == null || (cudaPackages ? desiredName) then
|
if finalAttrs.passthru.featureRelease.cudnnVersion == null || (cudaPackages ? desiredName) then
|
||||||
cudaPackages.cudnn
|
cudaPackages.cudnn
|
||||||
|
|
|
@ -1,399 +0,0 @@
|
||||||
# Type aliases
|
|
||||||
# Gpu :: AttrSet
|
|
||||||
# - See the documentation in ./gpus.nix.
|
|
||||||
{
|
|
||||||
config,
|
|
||||||
cudaCapabilities ? (config.cudaCapabilities or [ ]),
|
|
||||||
cudaForwardCompat ? (config.cudaForwardCompat or true),
|
|
||||||
lib,
|
|
||||||
cudaMajorMinorVersion,
|
|
||||||
stdenv,
|
|
||||||
# gpus :: List Gpu
|
|
||||||
gpus,
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
inherit (lib)
|
|
||||||
asserts
|
|
||||||
attrsets
|
|
||||||
lists
|
|
||||||
strings
|
|
||||||
trivial
|
|
||||||
;
|
|
||||||
|
|
||||||
inherit (stdenv) hostPlatform;
|
|
||||||
|
|
||||||
# Flags are determined based on your CUDA toolkit by default. You may benefit
|
|
||||||
# from improved performance, reduced file size, or greater hardware support by
|
|
||||||
# passing a configuration based on your specific GPU environment.
|
|
||||||
#
|
|
||||||
# cudaCapabilities :: List Capability
|
|
||||||
# List of hardware generations to build.
|
|
||||||
# E.g. [ "8.0" ]
|
|
||||||
# Currently, the last item is considered the optional forward-compatibility arch,
|
|
||||||
# but this may change in the future.
|
|
||||||
#
|
|
||||||
# cudaForwardCompat :: Bool
|
|
||||||
# Whether to include the forward compatibility gencode (+PTX)
|
|
||||||
# to support future GPU generations.
|
|
||||||
# E.g. true
|
|
||||||
#
|
|
||||||
# Please see the accompanying documentation or https://github.com/NixOS/nixpkgs/pull/205351
|
|
||||||
|
|
||||||
# isSupported :: Gpu -> Bool
|
|
||||||
isSupported =
|
|
||||||
gpu:
|
|
||||||
let
|
|
||||||
inherit (gpu) minCudaVersion maxCudaVersion;
|
|
||||||
lowerBoundSatisfied = strings.versionAtLeast cudaMajorMinorVersion minCudaVersion;
|
|
||||||
upperBoundSatisfied =
|
|
||||||
(maxCudaVersion == null) || !(strings.versionOlder maxCudaVersion cudaMajorMinorVersion);
|
|
||||||
in
|
|
||||||
lowerBoundSatisfied && upperBoundSatisfied;
|
|
||||||
|
|
||||||
# NOTE: Jetson is never built by default.
|
|
||||||
# isDefault :: Gpu -> Bool
|
|
||||||
isDefault =
|
|
||||||
gpu:
|
|
||||||
let
|
|
||||||
inherit (gpu) dontDefaultAfter isJetson;
|
|
||||||
newGpu = dontDefaultAfter == null;
|
|
||||||
recentGpu = newGpu || strings.versionAtLeast dontDefaultAfter cudaMajorMinorVersion;
|
|
||||||
in
|
|
||||||
recentGpu && !isJetson;
|
|
||||||
|
|
||||||
# supportedGpus :: List Gpu
|
|
||||||
# GPUs which are supported by the provided CUDA version.
|
|
||||||
supportedGpus = builtins.filter isSupported gpus;
|
|
||||||
|
|
||||||
# defaultGpus :: List Gpu
|
|
||||||
# GPUs which are supported by the provided CUDA version and we want to build for by default.
|
|
||||||
defaultGpus = builtins.filter isDefault supportedGpus;
|
|
||||||
|
|
||||||
# supportedCapabilities :: List Capability
|
|
||||||
supportedCapabilities = lists.map (gpu: gpu.computeCapability) supportedGpus;
|
|
||||||
|
|
||||||
# defaultCapabilities :: List Capability
|
|
||||||
# The default capabilities to target, if not overridden by the user.
|
|
||||||
defaultCapabilities = lists.map (gpu: gpu.computeCapability) defaultGpus;
|
|
||||||
|
|
||||||
# cudaArchNameToVersions :: AttrSet String (List String)
|
|
||||||
# Maps the name of a GPU architecture to different versions of that architecture.
|
|
||||||
# For example, "Ampere" maps to [ "8.0" "8.6" "8.7" ].
|
|
||||||
cudaArchNameToVersions = lists.groupBy' (versions: gpu: versions ++ [ gpu.computeCapability ]) [ ] (
|
|
||||||
gpu: gpu.archName
|
|
||||||
) supportedGpus;
|
|
||||||
|
|
||||||
# cudaComputeCapabilityToName :: AttrSet String String
|
|
||||||
# Maps the version of a GPU architecture to the name of that architecture.
|
|
||||||
# For example, "8.0" maps to "Ampere".
|
|
||||||
cudaComputeCapabilityToName = builtins.listToAttrs (
|
|
||||||
lists.map (gpu: attrsets.nameValuePair gpu.computeCapability gpu.archName) supportedGpus
|
|
||||||
);
|
|
||||||
|
|
||||||
# cudaComputeCapabilityToIsJetson :: AttrSet String Boolean
|
|
||||||
cudaComputeCapabilityToIsJetson = builtins.listToAttrs (
|
|
||||||
lists.map (attrs: attrsets.nameValuePair attrs.computeCapability attrs.isJetson) supportedGpus
|
|
||||||
);
|
|
||||||
|
|
||||||
# jetsonComputeCapabilities :: List String
|
|
||||||
jetsonComputeCapabilities = trivial.pipe cudaComputeCapabilityToIsJetson [
|
|
||||||
(attrsets.filterAttrs (_: isJetson: isJetson))
|
|
||||||
builtins.attrNames
|
|
||||||
];
|
|
||||||
|
|
||||||
# Find the intersection with the user-specified list of cudaCapabilities.
|
|
||||||
# NOTE: Jetson devices are never built by default because they cannot be targeted along with
|
|
||||||
# non-Jetson devices and require an aarch64 host platform. As such, if they're present anywhere,
|
|
||||||
# they must be in the user-specified cudaCapabilities.
|
|
||||||
# NOTE: We don't need to worry about mixes of Jetson and non-Jetson devices here -- there's
|
|
||||||
# sanity-checking for all that in below.
|
|
||||||
jetsonTargets = lists.intersectLists jetsonComputeCapabilities cudaCapabilities;
|
|
||||||
|
|
||||||
# dropDot :: String -> String
|
|
||||||
dropDot = ver: builtins.replaceStrings [ "." ] [ "" ] ver;
|
|
||||||
|
|
||||||
# archMapper :: String -> List String -> List String
|
|
||||||
# Maps a feature across a list of architecture versions to produce a list of architectures.
|
|
||||||
# For example, "sm" and [ "8.0" "8.6" "8.7" ] produces [ "sm_80" "sm_86" "sm_87" ].
|
|
||||||
archMapper = feat: lists.map (computeCapability: "${feat}_${dropDot computeCapability}");
|
|
||||||
|
|
||||||
# gencodeMapper :: String -> List String -> List String
|
|
||||||
# Maps a feature across a list of architecture versions to produce a list of gencode arguments.
|
|
||||||
# For example, "sm" and [ "8.0" "8.6" "8.7" ] produces [ "-gencode=arch=compute_80,code=sm_80"
|
|
||||||
# "-gencode=arch=compute_86,code=sm_86" "-gencode=arch=compute_87,code=sm_87" ].
|
|
||||||
gencodeMapper =
|
|
||||||
feat:
|
|
||||||
lists.map (
|
|
||||||
computeCapability:
|
|
||||||
"-gencode=arch=compute_${dropDot computeCapability},code=${feat}_${dropDot computeCapability}"
|
|
||||||
);
|
|
||||||
|
|
||||||
# Maps Nix system to NVIDIA redist arch.
|
|
||||||
# NOTE: We swap out the default `linux-sbsa` redist (for server-grade ARM chips) with the
|
|
||||||
# `linux-aarch64` redist (which is for Jetson devices) if we're building any Jetson devices.
|
|
||||||
# Since both are based on aarch64, we can only have one or the other, otherwise there's an
|
|
||||||
# ambiguity as to which should be used.
|
|
||||||
# NOTE: This function *will* be called by unsupported systems because `cudaPackages` is part of
|
|
||||||
# `all-packages.nix`, which is evaluated on all systems. As such, we need to handle unsupported
|
|
||||||
# systems gracefully.
|
|
||||||
# getRedistArch :: String -> String
|
|
||||||
getRedistArch =
|
|
||||||
nixSystem:
|
|
||||||
attrsets.attrByPath [ nixSystem ] "unsupported" {
|
|
||||||
aarch64-linux = if jetsonTargets != [ ] then "linux-aarch64" else "linux-sbsa";
|
|
||||||
x86_64-linux = "linux-x86_64";
|
|
||||||
ppc64le-linux = "linux-ppc64le";
|
|
||||||
x86_64-windows = "windows-x86_64";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Maps NVIDIA redist arch to Nix system.
|
|
||||||
# NOTE: This function *will* be called by unsupported systems because `cudaPackages` is part of
|
|
||||||
# `all-packages.nix`, which is evaluated on all systems. As such, we need to handle unsupported
|
|
||||||
# systems gracefully.
|
|
||||||
# getNixSystem :: String -> String
|
|
||||||
getNixSystem =
|
|
||||||
redistArch:
|
|
||||||
attrsets.attrByPath [ redistArch ] "unsupported-${redistArch}" {
|
|
||||||
linux-sbsa = "aarch64-linux";
|
|
||||||
linux-aarch64 = "aarch64-linux";
|
|
||||||
linux-x86_64 = "x86_64-linux";
|
|
||||||
linux-ppc64le = "ppc64le-linux";
|
|
||||||
windows-x86_64 = "x86_64-windows";
|
|
||||||
};
|
|
||||||
|
|
||||||
formatCapabilities =
|
|
||||||
{
|
|
||||||
cudaCapabilities,
|
|
||||||
enableForwardCompat ? true,
|
|
||||||
}:
|
|
||||||
rec {
|
|
||||||
inherit cudaCapabilities enableForwardCompat;
|
|
||||||
|
|
||||||
# archNames :: List String
|
|
||||||
# E.g. [ "Turing" "Ampere" ]
|
|
||||||
#
|
|
||||||
# Unknown architectures are rendered as sm_XX gencode flags.
|
|
||||||
archNames = lists.unique (
|
|
||||||
lists.map (cap: cudaComputeCapabilityToName.${cap} or "sm_${dropDot cap}") cudaCapabilities
|
|
||||||
);
|
|
||||||
|
|
||||||
# realArches :: List String
|
|
||||||
# The real architectures are physical architectures supported by the CUDA version.
|
|
||||||
# E.g. [ "sm_75" "sm_86" ]
|
|
||||||
realArches = archMapper "sm" cudaCapabilities;
|
|
||||||
|
|
||||||
# virtualArches :: List String
|
|
||||||
# The virtual architectures are typically used for forward compatibility, when trying to support
|
|
||||||
# an architecture newer than the CUDA version allows.
|
|
||||||
# E.g. [ "compute_75" "compute_86" ]
|
|
||||||
virtualArches = archMapper "compute" cudaCapabilities;
|
|
||||||
|
|
||||||
# arches :: List String
|
|
||||||
# By default, build for all supported architectures and forward compatibility via a virtual
|
|
||||||
# architecture for the newest supported architecture.
|
|
||||||
# E.g. [ "sm_75" "sm_86" "compute_86" ]
|
|
||||||
arches = realArches ++ lists.optional enableForwardCompat (lists.last virtualArches);
|
|
||||||
|
|
||||||
# gencode :: List String
|
|
||||||
# A list of CUDA gencode arguments to pass to NVCC.
|
|
||||||
# E.g. [ "-gencode=arch=compute_75,code=sm_75" ... "-gencode=arch=compute_86,code=compute_86" ]
|
|
||||||
gencode =
|
|
||||||
let
|
|
||||||
base = gencodeMapper "sm" cudaCapabilities;
|
|
||||||
forward = gencodeMapper "compute" [ (lists.last cudaCapabilities) ];
|
|
||||||
in
|
|
||||||
base ++ lib.optionals enableForwardCompat forward;
|
|
||||||
|
|
||||||
# gencodeString :: String
|
|
||||||
# A space-separated string of CUDA gencode arguments to pass to NVCC.
|
|
||||||
# E.g. "-gencode=arch=compute_75,code=sm_75 ... -gencode=arch=compute_86,code=compute_86"
|
|
||||||
gencodeString = strings.concatStringsSep " " gencode;
|
|
||||||
|
|
||||||
# cmakeCudaArchitecturesString :: String
|
|
||||||
# A semicolon-separated string of CUDA capabilities without dots, suitable for passing to CMake.
|
|
||||||
# E.g. "75;86"
|
|
||||||
cmakeCudaArchitecturesString = strings.concatMapStringsSep ";" dropDot cudaCapabilities;
|
|
||||||
|
|
||||||
# Jetson devices cannot be targeted by the same binaries which target non-Jetson devices. While
|
|
||||||
# NVIDIA provides both `linux-aarch64` and `linux-sbsa` packages, which both target `aarch64`,
|
|
||||||
# they are built with different settings and cannot be mixed.
|
|
||||||
# isJetsonBuild :: Boolean
|
|
||||||
isJetsonBuild =
|
|
||||||
let
|
|
||||||
requestedJetsonDevices = lists.filter (
|
|
||||||
cap: cudaComputeCapabilityToIsJetson.${cap} or false
|
|
||||||
) cudaCapabilities;
|
|
||||||
requestedNonJetsonDevices = lists.filter (
|
|
||||||
cap: !(builtins.elem cap requestedJetsonDevices)
|
|
||||||
) cudaCapabilities;
|
|
||||||
jetsonBuildSufficientCondition = requestedJetsonDevices != [ ];
|
|
||||||
jetsonBuildNecessaryCondition = requestedNonJetsonDevices == [ ] && hostPlatform.isAarch64;
|
|
||||||
in
|
|
||||||
trivial.throwIf (jetsonBuildSufficientCondition && !jetsonBuildNecessaryCondition) ''
|
|
||||||
Jetson devices cannot be targeted with non-Jetson devices. Additionally, they require hostPlatform to be aarch64.
|
|
||||||
You requested ${builtins.toJSON cudaCapabilities} for host platform ${hostPlatform.system}.
|
|
||||||
Requested Jetson devices: ${builtins.toJSON requestedJetsonDevices}.
|
|
||||||
Requested non-Jetson devices: ${builtins.toJSON requestedNonJetsonDevices}.
|
|
||||||
Exactly one of the following must be true:
|
|
||||||
- All CUDA capabilities belong to Jetson devices and hostPlatform is aarch64.
|
|
||||||
- No CUDA capabilities belong to Jetson devices.
|
|
||||||
See ${./gpus.nix} for a list of architectures supported by this version of Nixpkgs.
|
|
||||||
'' jetsonBuildSufficientCondition
|
|
||||||
&& jetsonBuildNecessaryCondition;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
# When changing names or formats: pause, validate, and update the assert
|
|
||||||
assert
|
|
||||||
let
|
|
||||||
expected = {
|
|
||||||
cudaCapabilities = [
|
|
||||||
"7.5"
|
|
||||||
"8.6"
|
|
||||||
];
|
|
||||||
enableForwardCompat = true;
|
|
||||||
|
|
||||||
archNames = [
|
|
||||||
"Turing"
|
|
||||||
"Ampere"
|
|
||||||
];
|
|
||||||
realArches = [
|
|
||||||
"sm_75"
|
|
||||||
"sm_86"
|
|
||||||
];
|
|
||||||
virtualArches = [
|
|
||||||
"compute_75"
|
|
||||||
"compute_86"
|
|
||||||
];
|
|
||||||
arches = [
|
|
||||||
"sm_75"
|
|
||||||
"sm_86"
|
|
||||||
"compute_86"
|
|
||||||
];
|
|
||||||
|
|
||||||
gencode = [
|
|
||||||
"-gencode=arch=compute_75,code=sm_75"
|
|
||||||
"-gencode=arch=compute_86,code=sm_86"
|
|
||||||
"-gencode=arch=compute_86,code=compute_86"
|
|
||||||
];
|
|
||||||
gencodeString = "-gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_86,code=compute_86";
|
|
||||||
|
|
||||||
cmakeCudaArchitecturesString = "75;86";
|
|
||||||
|
|
||||||
isJetsonBuild = false;
|
|
||||||
};
|
|
||||||
actual = formatCapabilities {
|
|
||||||
cudaCapabilities = [
|
|
||||||
"7.5"
|
|
||||||
"8.6"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
actualWrapped = (builtins.tryEval (builtins.deepSeq actual actual)).value;
|
|
||||||
in
|
|
||||||
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
|
|
||||||
expected = false;
|
|
||||||
actual = formatCapabilities {
|
|
||||||
cudaCapabilities = [
|
|
||||||
"7.2"
|
|
||||||
"7.5"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
actualWrapped = (builtins.tryEval (builtins.deepSeq actual actual)).value;
|
|
||||||
in
|
|
||||||
asserts.assertMsg (expected == actualWrapped) ''
|
|
||||||
Jetson devices capabilities cannot be mixed with non-jetson devices.
|
|
||||||
Capability 7.5 is non-Jetson and should not be allowed with Jetson 7.2.
|
|
||||||
Expected: ${builtins.toJSON expected}
|
|
||||||
Actual: ${builtins.toJSON actualWrapped}
|
|
||||||
'';
|
|
||||||
# Check Jetson-only
|
|
||||||
assert
|
|
||||||
let
|
|
||||||
expected = {
|
|
||||||
cudaCapabilities = [
|
|
||||||
"6.2"
|
|
||||||
"7.2"
|
|
||||||
];
|
|
||||||
enableForwardCompat = true;
|
|
||||||
|
|
||||||
archNames = [
|
|
||||||
"Pascal"
|
|
||||||
"Volta"
|
|
||||||
];
|
|
||||||
realArches = [
|
|
||||||
"sm_62"
|
|
||||||
"sm_72"
|
|
||||||
];
|
|
||||||
virtualArches = [
|
|
||||||
"compute_62"
|
|
||||||
"compute_72"
|
|
||||||
];
|
|
||||||
arches = [
|
|
||||||
"sm_62"
|
|
||||||
"sm_72"
|
|
||||||
"compute_72"
|
|
||||||
];
|
|
||||||
|
|
||||||
gencode = [
|
|
||||||
"-gencode=arch=compute_62,code=sm_62"
|
|
||||||
"-gencode=arch=compute_72,code=sm_72"
|
|
||||||
"-gencode=arch=compute_72,code=compute_72"
|
|
||||||
];
|
|
||||||
gencodeString = "-gencode=arch=compute_62,code=sm_62 -gencode=arch=compute_72,code=sm_72 -gencode=arch=compute_72,code=compute_72";
|
|
||||||
|
|
||||||
cmakeCudaArchitecturesString = "62;72";
|
|
||||||
|
|
||||||
isJetsonBuild = true;
|
|
||||||
};
|
|
||||||
actual = formatCapabilities {
|
|
||||||
cudaCapabilities = [
|
|
||||||
"6.2"
|
|
||||||
"7.2"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
actualWrapped = (builtins.tryEval (builtins.deepSeq actual actual)).value;
|
|
||||||
in
|
|
||||||
asserts.assertMsg
|
|
||||||
# We can't do this test unless we're targeting aarch64
|
|
||||||
(hostPlatform.isAarch64 -> (expected == actualWrapped))
|
|
||||||
''
|
|
||||||
Jetson devices can only be built with other Jetson devices.
|
|
||||||
Both 6.2 and 7.2 are Jetson devices.
|
|
||||||
Expected: ${builtins.toJSON expected}
|
|
||||||
Actual: ${builtins.toJSON actualWrapped}
|
|
||||||
'';
|
|
||||||
{
|
|
||||||
# formatCapabilities :: { cudaCapabilities: List Capability, enableForwardCompat: Boolean } -> { ... }
|
|
||||||
inherit formatCapabilities;
|
|
||||||
|
|
||||||
# cudaArchNameToVersions :: String => String
|
|
||||||
inherit cudaArchNameToVersions;
|
|
||||||
|
|
||||||
# cudaComputeCapabilityToName :: String => String
|
|
||||||
inherit cudaComputeCapabilityToName;
|
|
||||||
|
|
||||||
# dropDot :: String -> String
|
|
||||||
inherit dropDot;
|
|
||||||
|
|
||||||
inherit
|
|
||||||
defaultCapabilities
|
|
||||||
supportedCapabilities
|
|
||||||
jetsonComputeCapabilities
|
|
||||||
jetsonTargets
|
|
||||||
getNixSystem
|
|
||||||
getRedistArch
|
|
||||||
;
|
|
||||||
}
|
|
||||||
// formatCapabilities {
|
|
||||||
cudaCapabilities = if cudaCapabilities == [ ] then defaultCapabilities else cudaCapabilities;
|
|
||||||
enableForwardCompat = cudaForwardCompat;
|
|
||||||
}
|
|
|
@ -5,6 +5,7 @@
|
||||||
autoPatchelfHook,
|
autoPatchelfHook,
|
||||||
backendStdenv,
|
backendStdenv,
|
||||||
callPackage,
|
callPackage,
|
||||||
|
cudaLib,
|
||||||
fetchurl,
|
fetchurl,
|
||||||
fixups,
|
fixups,
|
||||||
lib,
|
lib,
|
||||||
|
@ -47,15 +48,15 @@ let
|
||||||
maybeFixup = fixups.${pname} or null;
|
maybeFixup = fixups.${pname} or null;
|
||||||
fixup = if maybeFixup != null then callPackage maybeFixup { } else { };
|
fixup = if maybeFixup != null then callPackage maybeFixup { } else { };
|
||||||
|
|
||||||
# Get the redist architectures for which package provides distributables.
|
# Get the redist systems for which package provides distributables.
|
||||||
# These are used by meta.platforms.
|
# These are used by meta.platforms.
|
||||||
supportedRedistArchs = builtins.attrNames featureRelease;
|
supportedRedistSystems = builtins.attrNames featureRelease;
|
||||||
# redistArch :: String
|
# redistSystem :: String
|
||||||
# The redistArch is the name of the architecture for which the redistributable is built.
|
# The redistSystem is the name of the system for which the redistributable is built.
|
||||||
# It is `"unsupported"` if the redistributable is not supported on the target platform.
|
# It is `"unsupported"` if the redistributable is not supported on the target system.
|
||||||
redistArch = flags.getRedistArch hostPlatform.system;
|
redistSystem = cudaLib.utils.getRedistSystem backendStdenv.hasJetsonCudaCapability hostPlatform.system;
|
||||||
|
|
||||||
sourceMatchesHost = flags.getNixSystem redistArch == hostPlatform.system;
|
sourceMatchesHost = lib.elem hostPlatform.system (cudaLib.utils.getNixSystems redistSystem);
|
||||||
in
|
in
|
||||||
(backendStdenv.mkDerivation (finalAttrs: {
|
(backendStdenv.mkDerivation (finalAttrs: {
|
||||||
# NOTE: Even though there's no actual buildPhase going on here, the derivations of the
|
# NOTE: Even though there's no actual buildPhase going on here, the derivations of the
|
||||||
|
@ -81,7 +82,7 @@ in
|
||||||
hasOutput =
|
hasOutput =
|
||||||
output:
|
output:
|
||||||
attrsets.attrByPath [
|
attrsets.attrByPath [
|
||||||
redistArch
|
redistSystem
|
||||||
"outputs"
|
"outputs"
|
||||||
output
|
output
|
||||||
] false featureRelease;
|
] false featureRelease;
|
||||||
|
@ -99,12 +100,15 @@ in
|
||||||
# NOTE: In the case the redistributable isn't supported on the target platform,
|
# NOTE: In the case the redistributable isn't supported on the target platform,
|
||||||
# we will have `outputs = [ "out" ] ++ possibleOutputs`. This is of note because platforms which
|
# we will have `outputs = [ "out" ] ++ possibleOutputs`. This is of note because platforms which
|
||||||
# aren't supported would otherwise have evaluation errors when trying to access outputs other than `out`.
|
# aren't supported would otherwise have evaluation errors when trying to access outputs other than `out`.
|
||||||
# The alternative would be to have `outputs = [ "out" ]` when`redistArch = "unsupported"`, but that would
|
# The alternative would be to have `outputs = [ "out" ]` when`redistSystem = "unsupported"`, but that would
|
||||||
# require adding guards throughout the entirety of the CUDA package set to ensure `cudaSupport` is true --
|
# require adding guards throughout the entirety of the CUDA package set to ensure `cudaSupport` is true --
|
||||||
# recall that OfBorg will evaluate packages marked as broken and that `cudaPackages` will be evaluated with
|
# recall that OfBorg will evaluate packages marked as broken and that `cudaPackages` will be evaluated with
|
||||||
# `cudaSupport = false`!
|
# `cudaSupport = false`!
|
||||||
additionalOutputs =
|
additionalOutputs =
|
||||||
if redistArch == "unsupported" then possibleOutputs else builtins.filter hasOutput possibleOutputs;
|
if redistSystem == "unsupported" then
|
||||||
|
possibleOutputs
|
||||||
|
else
|
||||||
|
builtins.filter hasOutput possibleOutputs;
|
||||||
# The out output is special -- it's the default output and we always include it.
|
# The out output is special -- it's the default output and we always include it.
|
||||||
outputs = [ "out" ] ++ additionalOutputs;
|
outputs = [ "out" ] ++ additionalOutputs;
|
||||||
in
|
in
|
||||||
|
@ -155,14 +159,14 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
# src :: Optional Derivation
|
# src :: Optional Derivation
|
||||||
# If redistArch doesn't exist in redistribRelease, return null.
|
# If redistSystem doesn't exist in redistribRelease, return null.
|
||||||
src = trivial.mapNullable (
|
src = trivial.mapNullable (
|
||||||
{ relative_path, sha256, ... }:
|
{ relative_path, sha256, ... }:
|
||||||
fetchurl {
|
fetchurl {
|
||||||
url = "https://developer.download.nvidia.com/compute/${redistName}/redist/${relative_path}";
|
url = "https://developer.download.nvidia.com/compute/${redistName}/redist/${relative_path}";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
}
|
}
|
||||||
) (redistribRelease.${redistArch} or null);
|
) (redistribRelease.${redistSystem} or null);
|
||||||
|
|
||||||
postPatch =
|
postPatch =
|
||||||
# Pkg-config's setup hook expects configuration files in $out/share/pkgconfig
|
# Pkg-config's setup hook expects configuration files in $out/share/pkgconfig
|
||||||
|
@ -321,11 +325,13 @@ in
|
||||||
description = "${redistribRelease.name}. By downloading and using the packages you accept the terms and conditions of the ${finalAttrs.meta.license.shortName}";
|
description = "${redistribRelease.name}. By downloading and using the packages you accept the terms and conditions of the ${finalAttrs.meta.license.shortName}";
|
||||||
sourceProvenance = [ sourceTypes.binaryNativeCode ];
|
sourceProvenance = [ sourceTypes.binaryNativeCode ];
|
||||||
broken = lists.any trivial.id (attrsets.attrValues finalAttrs.brokenConditions);
|
broken = lists.any trivial.id (attrsets.attrValues finalAttrs.brokenConditions);
|
||||||
platforms = trivial.pipe supportedRedistArchs [
|
platforms = trivial.pipe supportedRedistSystems [
|
||||||
# Map each redist arch to the equivalent nix system or null if there is no equivalent.
|
# Map each redist system to the equivalent nix systems.
|
||||||
(builtins.map flags.getNixSystem)
|
(lib.concatMap cudaLib.utils.getNixSystems)
|
||||||
# Filter out unsupported systems
|
# Take all the unique values.
|
||||||
(builtins.filter (nixSystem: !(strings.hasPrefix "unsupported-" nixSystem)))
|
lib.unique
|
||||||
|
# Sort the list.
|
||||||
|
lib.naturalSort
|
||||||
];
|
];
|
||||||
badPlatforms =
|
badPlatforms =
|
||||||
let
|
let
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
{
|
{
|
||||||
# callPackage-provided arguments
|
|
||||||
lib,
|
lib,
|
||||||
|
cudaLib,
|
||||||
cudaMajorMinorVersion,
|
cudaMajorMinorVersion,
|
||||||
flags,
|
redistSystem,
|
||||||
stdenv,
|
stdenv,
|
||||||
# Expected to be passed by the caller
|
|
||||||
mkVersionedPackageName,
|
|
||||||
# Builder-specific arguments
|
# Builder-specific arguments
|
||||||
# Short package name (e.g., "cuda_cccl")
|
# Short package name (e.g., "cuda_cccl")
|
||||||
# pname : String
|
# pname : String
|
||||||
|
@ -26,7 +24,7 @@
|
||||||
# The featureRelease is used to populate meta.platforms (by way of looking at the attribute names), determine the
|
# The featureRelease is used to populate meta.platforms (by way of looking at the attribute names), determine the
|
||||||
# outputs of the package, and provide additional package-specific constraints (e.g., min/max supported CUDA versions,
|
# outputs of the package, and provide additional package-specific constraints (e.g., min/max supported CUDA versions,
|
||||||
# required versions of other packages, etc.).
|
# required versions of other packages, etc.).
|
||||||
# shimFn :: {package, redistArch} -> AttrSet
|
# shimFn :: {package, redistSystem} -> AttrSet
|
||||||
shimsFn ? (throw "shimsFn must be provided"),
|
shimsFn ? (throw "shimsFn must be provided"),
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -41,10 +39,6 @@ let
|
||||||
# - Releases: ../modules/${pname}/releases/releases.nix
|
# - Releases: ../modules/${pname}/releases/releases.nix
|
||||||
# - Package: ../modules/${pname}/releases/package.nix
|
# - Package: ../modules/${pname}/releases/package.nix
|
||||||
|
|
||||||
# redistArch :: String
|
|
||||||
# Value is `"unsupported"` if the platform is not supported.
|
|
||||||
redistArch = flags.getRedistArch stdenv.hostPlatform.system;
|
|
||||||
|
|
||||||
# Check whether a package supports our CUDA version.
|
# Check whether a package supports our CUDA version.
|
||||||
# satisfiesCudaVersion :: Package -> Bool
|
# satisfiesCudaVersion :: Package -> Bool
|
||||||
satisfiesCudaVersion =
|
satisfiesCudaVersion =
|
||||||
|
@ -53,7 +47,7 @@ let
|
||||||
&& lib.versionAtLeast package.maxCudaVersion cudaMajorMinorVersion;
|
&& lib.versionAtLeast package.maxCudaVersion cudaMajorMinorVersion;
|
||||||
|
|
||||||
# FIXME: do this at the module system level
|
# FIXME: do this at the module system level
|
||||||
propagatePlatforms = lib.mapAttrs (redistArch: lib.map (p: { inherit redistArch; } // p));
|
propagatePlatforms = lib.mapAttrs (redistSystem: lib.map (p: { inherit redistSystem; } // p));
|
||||||
|
|
||||||
# Releases for all platforms and all CUDA versions.
|
# Releases for all platforms and all CUDA versions.
|
||||||
allReleases = propagatePlatforms evaluatedModules.config.${pname}.releases;
|
allReleases = propagatePlatforms evaluatedModules.config.${pname}.releases;
|
||||||
|
@ -65,12 +59,13 @@ let
|
||||||
allPackages = lib.concatLists (lib.attrValues allReleases');
|
allPackages = lib.concatLists (lib.attrValues allReleases');
|
||||||
|
|
||||||
packageOlder = p1: p2: lib.versionOlder p1.version p2.version;
|
packageOlder = p1: p2: lib.versionOlder p1.version p2.version;
|
||||||
packageSupportedPlatform = p: p.redistArch == redistArch;
|
packageSupportedPlatform = p: p.redistSystem == redistSystem;
|
||||||
|
|
||||||
# Compute versioned attribute name to be used in this package set
|
# Compute versioned attribute name to be used in this package set
|
||||||
# Patch version changes should not break the build, so we only use major and minor
|
# Patch version changes should not break the build, so we only use major and minor
|
||||||
# computeName :: Package -> String
|
# computeName :: Package -> String
|
||||||
computeName = package: mkVersionedPackageName pname package.version;
|
computeName =
|
||||||
|
{ version, ... }: cudaLib.utils.mkVersionedName pname (lib.versions.majorMinor version);
|
||||||
|
|
||||||
# The newest package for each major-minor version, with newest first.
|
# The newest package for each major-minor version, with newest first.
|
||||||
# newestPackages :: List Package
|
# newestPackages :: List Package
|
||||||
|
@ -113,7 +108,7 @@ let
|
||||||
buildPackage =
|
buildPackage =
|
||||||
package:
|
package:
|
||||||
let
|
let
|
||||||
shims = final.callPackage shimsFn { inherit package redistArch; };
|
shims = final.callPackage shimsFn { inherit package redistSystem; };
|
||||||
name = computeName package;
|
name = computeName package;
|
||||||
drv = final.callPackage ./manifest.nix {
|
drv = final.callPackage ./manifest.nix {
|
||||||
inherit pname redistName;
|
inherit pname redistName;
|
||||||
|
|
|
@ -1,244 +0,0 @@
|
||||||
# Type aliases
|
|
||||||
#
|
|
||||||
# Gpu = {
|
|
||||||
# archName: String
|
|
||||||
# - The name of the microarchitecture.
|
|
||||||
# computeCapability: String
|
|
||||||
# - The compute capability of the GPU.
|
|
||||||
# isJetson: Boolean
|
|
||||||
# - Whether a GPU is part of NVIDIA's line of Jetson embedded computers. This field is
|
|
||||||
# notable because it tells us what architecture to build for (as Jetson devices are
|
|
||||||
# aarch64).
|
|
||||||
# More on Jetson devices here:
|
|
||||||
# https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/
|
|
||||||
# NOTE: These architectures are only built upon request.
|
|
||||||
# minCudaVersion: String
|
|
||||||
# - The minimum (inclusive) CUDA version that supports this GPU.
|
|
||||||
# dontDefaultAfter: null | String
|
|
||||||
# - The CUDA version after which to exclude this GPU from the list of default capabilities
|
|
||||||
# we build. null means we always include this GPU in the default capabilities if it is
|
|
||||||
# supported.
|
|
||||||
# maxCudaVersion: null | String
|
|
||||||
# - The maximum (exclusive) CUDA version that supports this GPU. null means there is no
|
|
||||||
# maximum.
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# Many thanks to Arnon Shimoni for maintaining a list of these architectures and capabilities.
|
|
||||||
# Without your work, this would have been much more difficult.
|
|
||||||
# https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
|
|
||||||
#
|
|
||||||
# https://en.wikipedia.org/wiki/CUDA#GPUs_supported
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
# Tesla K40
|
|
||||||
archName = "Kepler";
|
|
||||||
computeCapability = "3.5";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = "11.0";
|
|
||||||
maxCudaVersion = "11.8";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Tesla K80
|
|
||||||
archName = "Kepler";
|
|
||||||
computeCapability = "3.7";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = "11.0";
|
|
||||||
maxCudaVersion = "11.8";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Tesla/Quadro M series
|
|
||||||
archName = "Maxwell";
|
|
||||||
computeCapability = "5.0";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = "11.0";
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Quadro M6000, GeForce 900, GTX-970, GTX-980, GTX Titan X
|
|
||||||
archName = "Maxwell";
|
|
||||||
computeCapability = "5.2";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = "11.0";
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Tegra (Jetson) TX1 / Tegra X1, Drive CX, Drive PX, Jetson Nano
|
|
||||||
archName = "Maxwell";
|
|
||||||
computeCapability = "5.3";
|
|
||||||
isJetson = true;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Quadro GP100, Tesla P100, DGX-1 (Generic Pascal)
|
|
||||||
archName = "Pascal";
|
|
||||||
computeCapability = "6.0";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# GTX 1080, GTX 1070, GTX 1060, GTX 1050, GTX 1030 (GP108), GT 1010 (GP108) Titan Xp, Tesla
|
|
||||||
# P40, Tesla P4, Discrete GPU on the NVIDIA Drive PX2
|
|
||||||
archName = "Pascal";
|
|
||||||
computeCapability = "6.1";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Integrated GPU on the NVIDIA Drive PX2, Tegra (Jetson) TX2
|
|
||||||
archName = "Pascal";
|
|
||||||
computeCapability = "6.2";
|
|
||||||
isJetson = true;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# DGX-1 with Volta, Tesla V100, GTX 1180 (GV104), Titan V, Quadro GV100
|
|
||||||
archName = "Volta";
|
|
||||||
computeCapability = "7.0";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Jetson AGX Xavier, Drive AGX Pegasus, Xavier NX
|
|
||||||
archName = "Volta";
|
|
||||||
computeCapability = "7.2";
|
|
||||||
isJetson = true;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# GTX/RTX Turing – GTX 1660 Ti, RTX 2060, RTX 2070, RTX 2080, Titan RTX, Quadro RTX 4000,
|
|
||||||
# Quadro RTX 5000, Quadro RTX 6000, Quadro RTX 8000, Quadro T1000/T2000, Tesla T4
|
|
||||||
archName = "Turing";
|
|
||||||
computeCapability = "7.5";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "10.0";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# NVIDIA A100 (the name “Tesla” has been dropped – GA100), NVIDIA DGX-A100
|
|
||||||
archName = "Ampere";
|
|
||||||
computeCapability = "8.0";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "11.2";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Tesla GA10x cards, RTX Ampere – RTX 3080, GA102 – RTX 3090, RTX A2000, A3000, RTX A4000,
|
|
||||||
# A5000, A6000, NVIDIA A40, GA106 – RTX 3060, GA104 – RTX 3070, GA107 – RTX 3050, RTX A10, RTX
|
|
||||||
# A16, RTX A40, A2 Tensor Core GPU
|
|
||||||
archName = "Ampere";
|
|
||||||
computeCapability = "8.6";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "11.2";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Jetson AGX Orin and Drive AGX Orin only
|
|
||||||
archName = "Ampere";
|
|
||||||
computeCapability = "8.7";
|
|
||||||
isJetson = true;
|
|
||||||
minCudaVersion = "11.5";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# NVIDIA GeForce RTX 4090, RTX 4080, RTX 6000, Tesla L40
|
|
||||||
archName = "Ada";
|
|
||||||
computeCapability = "8.9";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "11.8";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# NVIDIA H100 (GH100)
|
|
||||||
archName = "Hopper";
|
|
||||||
computeCapability = "9.0";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "11.8";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# NVIDIA H100 (GH100) (Thor)
|
|
||||||
archName = "Hopper";
|
|
||||||
computeCapability = "9.0a";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "12.0";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# NVIDIA B100
|
|
||||||
archName = "Blackwell";
|
|
||||||
computeCapability = "10.0";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "12.8";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# NVIDIA B100 Accelerated
|
|
||||||
archName = "Blackwell";
|
|
||||||
computeCapability = "10.0a";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "12.8";
|
|
||||||
dontDefaultAfter = "12.0"; # disable to reduce size of OnnxRuntime and Torch CUDA binaries
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# NVIDIA Blackwell
|
|
||||||
archName = "Blackwell";
|
|
||||||
computeCapability = "10.1";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "12.8";
|
|
||||||
dontDefaultAfter = "12.0"; # disable to reduce size of OnnxRuntime and Torch CUDA binaries
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# NVIDIA Blackwell Accelerated
|
|
||||||
archName = "Blackwell";
|
|
||||||
computeCapability = "10.1a";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "12.8";
|
|
||||||
dontDefaultAfter = "12.0"; # disable to reduce size of OnnxRuntime and Torch CUDA binaries
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# NVIDIA GeForce RTX 5090 (GB202), RTX 5080 (GB203), RTX 5070 (GB205)
|
|
||||||
archName = "Blackwell";
|
|
||||||
computeCapability = "12.0";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "12.8";
|
|
||||||
dontDefaultAfter = null;
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# NVIDIA Blackwell Accelerated
|
|
||||||
archName = "Blackwell";
|
|
||||||
computeCapability = "12.0a";
|
|
||||||
isJetson = false;
|
|
||||||
minCudaVersion = "12.8";
|
|
||||||
dontDefaultAfter = "12.0"; # disable to reduce size of OnnxRuntime and Torch CUDA binaries
|
|
||||||
maxCudaVersion = null;
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,125 +0,0 @@
|
||||||
# Taken from
|
|
||||||
# https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#host-compiler-support-policy
|
|
||||||
#
|
|
||||||
# NVCC performs a version check on the host compiler’s major version and so newer minor versions
|
|
||||||
# of the compilers listed below will be supported, but major versions falling outside the range
|
|
||||||
# will not be supported.
|
|
||||||
#
|
|
||||||
# NOTE: These constraints don't apply to Jetson, which uses something else.
|
|
||||||
# NOTE: NVIDIA can and will add support for newer compilers even during patch releases.
|
|
||||||
# E.g.: CUDA 12.2.1 maxxed out with support for Clang 15.0; 12.2.2 added support for Clang 16.0.
|
|
||||||
# NOTE: Because all platforms NVIDIA supports use GCC and Clang, we omit the architectures here.
|
|
||||||
# Type Aliases
|
|
||||||
# CudaVersion = String (two-part version number, e.g. "11.2")
|
|
||||||
# Platform = String (e.g. "x86_64-linux")
|
|
||||||
# CompilerCompatibilities = {
|
|
||||||
# clangMaxMajorVersion = String (e.g. "15")
|
|
||||||
# clangMinMajorVersion = String (e.g. "7")
|
|
||||||
# gccMaxMajorVersion = String (e.g. "11")
|
|
||||||
# gccMinMajorVersion = String (e.g. "6")
|
|
||||||
# }
|
|
||||||
let
|
|
||||||
# attrs :: AttrSet CudaVersion CompilerCompatibilities
|
|
||||||
attrs = {
|
|
||||||
# Our baseline
|
|
||||||
# https://docs.nvidia.com/cuda/archive/11.0/cuda-toolkit-release-notes/index.html#cuda-compiler-new-features
|
|
||||||
"11.0" = {
|
|
||||||
clangMaxMajorVersion = "9";
|
|
||||||
clangMinMajorVersion = "7";
|
|
||||||
gccMaxMajorVersion = "9";
|
|
||||||
gccMinMajorVersion = "6";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Added support for Clang 10 and GCC 10
|
|
||||||
# https://docs.nvidia.com/cuda/archive/11.1.1/cuda-toolkit-release-notes/index.html#cuda-compiler-new-features
|
|
||||||
"11.1" = attrs."11.0" // {
|
|
||||||
clangMaxMajorVersion = "10";
|
|
||||||
gccMaxMajorVersion = "10";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Added support for Clang 11
|
|
||||||
# https://docs.nvidia.com/cuda/archive/11.2.2/cuda-installation-guide-linux/index.html#system-requirements
|
|
||||||
"11.2" = attrs."11.1" // {
|
|
||||||
clangMaxMajorVersion = "11";
|
|
||||||
};
|
|
||||||
|
|
||||||
# No changes from 11.2 to 11.3
|
|
||||||
"11.3" = attrs."11.2";
|
|
||||||
|
|
||||||
# Added support for Clang 12 and GCC 11
|
|
||||||
# https://docs.nvidia.com/cuda/archive/11.4.4/cuda-toolkit-release-notes/index.html#cuda-general-new-features
|
|
||||||
"11.4" = attrs."11.3" // {
|
|
||||||
clangMaxMajorVersion = "12";
|
|
||||||
# NOTE: There is a bug in the version of GLIBC that GCC 11 uses which causes it to fail to compile some CUDA
|
|
||||||
# code. As such, we skip it for this release, and do the bump in 11.6 (skipping 11.5).
|
|
||||||
# https://forums.developer.nvidia.com/t/cuda-11-5-samples-throw-multiple-error-attribute-malloc-does-not-take-arguments/192750/15
|
|
||||||
# gccMaxMajorVersion = "11";
|
|
||||||
};
|
|
||||||
|
|
||||||
# No changes from 11.4 to 11.5
|
|
||||||
"11.5" = attrs."11.4";
|
|
||||||
|
|
||||||
# No changes from 11.5 to 11.6
|
|
||||||
# However, as mentioned above, we add GCC 11 this release.
|
|
||||||
"11.6" = attrs."11.5" // {
|
|
||||||
gccMaxMajorVersion = "11";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Added support for Clang 13
|
|
||||||
# https://docs.nvidia.com/cuda/archive/11.7.1/cuda-toolkit-release-notes/index.html#cuda-compiler-new-features
|
|
||||||
"11.7" = attrs."11.6" // {
|
|
||||||
clangMaxMajorVersion = "13";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Added support for Clang 14
|
|
||||||
# https://docs.nvidia.com/cuda/archive/11.8.0/cuda-installation-guide-linux/index.html#system-requirements
|
|
||||||
"11.8" = attrs."11.7" // {
|
|
||||||
clangMaxMajorVersion = "14";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Added support for GCC 12
|
|
||||||
# https://docs.nvidia.com/cuda/archive/12.0.1/cuda-installation-guide-linux/index.html#system-requirements
|
|
||||||
"12.0" = attrs."11.8" // {
|
|
||||||
gccMaxMajorVersion = "12";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Added support for Clang 15
|
|
||||||
# https://docs.nvidia.com/cuda/archive/12.1.1/cuda-toolkit-release-notes/index.html#cuda-compilers-new-features
|
|
||||||
"12.1" = attrs."12.0" // {
|
|
||||||
clangMaxMajorVersion = "15";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Added support for Clang 16
|
|
||||||
# https://docs.nvidia.com/cuda/archive/12.2.2/cuda-installation-guide-linux/index.html#host-compiler-support-policy
|
|
||||||
"12.2" = attrs."12.1" // {
|
|
||||||
clangMaxMajorVersion = "16";
|
|
||||||
};
|
|
||||||
|
|
||||||
# No changes from 12.2 to 12.3
|
|
||||||
"12.3" = attrs."12.2";
|
|
||||||
|
|
||||||
# Added support for Clang 17 and GCC 13
|
|
||||||
# https://docs.nvidia.com/cuda/archive/12.4.0/cuda-installation-guide-linux/index.html#host-compiler-support-policy
|
|
||||||
"12.4" = attrs."12.3" // {
|
|
||||||
clangMaxMajorVersion = "17";
|
|
||||||
gccMaxMajorVersion = "13";
|
|
||||||
};
|
|
||||||
|
|
||||||
# No changes from 12.4 to 12.5
|
|
||||||
"12.5" = attrs."12.4";
|
|
||||||
|
|
||||||
# Added support for Clang 18
|
|
||||||
# https://docs.nvidia.com/cuda/archive/12.6.0/cuda-installation-guide-linux/index.html#host-compiler-support-policy
|
|
||||||
"12.6" = attrs."12.4" // {
|
|
||||||
clangMaxMajorVersion = "18";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Added support for Clang 19 and GCC 14
|
|
||||||
# https://docs.nvidia.com/cuda/archive/12.8.0/cuda-installation-guide-linux/index.html#host-compiler-support-policy
|
|
||||||
"12.8" = attrs."12.6" // {
|
|
||||||
clangMaxMajorVersion = "19";
|
|
||||||
gccMaxMajorVersion = "14";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
attrs
|
|
|
@ -1,14 +1,14 @@
|
||||||
# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
|
# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
|
||||||
{
|
{
|
||||||
package,
|
package,
|
||||||
# redistArch :: String
|
# redistSystem :: String
|
||||||
# String is `"unsupported"` if the given architecture is unsupported.
|
# String is `"unsupported"` if the given architecture is unsupported.
|
||||||
redistArch,
|
redistSystem,
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
featureRelease = {
|
featureRelease = {
|
||||||
inherit (package) cudnnVersion minCudaVersion maxCudaVersion;
|
inherit (package) cudnnVersion minCudaVersion maxCudaVersion;
|
||||||
${redistArch}.outputs = {
|
${redistSystem}.outputs = {
|
||||||
bin = true;
|
bin = true;
|
||||||
lib = true;
|
lib = true;
|
||||||
static = true;
|
static = true;
|
||||||
|
|
78
pkgs/development/cuda-modules/tests/flags.nix
Normal file
78
pkgs/development/cuda-modules/tests/flags.nix
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
{
|
||||||
|
cudaLib,
|
||||||
|
cudaNamePrefix,
|
||||||
|
lib,
|
||||||
|
runCommand,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (builtins) deepSeq toJSON tryEval;
|
||||||
|
inherit (cudaLib.data) cudaCapabilityToInfo;
|
||||||
|
inherit (cudaLib.utils) formatCapabilities;
|
||||||
|
inherit (lib.asserts) assertMsg;
|
||||||
|
in
|
||||||
|
# When changing names or formats: pause, validate, and update the assert
|
||||||
|
assert assertMsg (
|
||||||
|
cudaCapabilityToInfo ? "7.5" && cudaCapabilityToInfo ? "8.6"
|
||||||
|
) "The following test requires both 7.5 and 8.6 be known CUDA capabilities";
|
||||||
|
assert
|
||||||
|
let
|
||||||
|
expected = {
|
||||||
|
cudaCapabilities = [
|
||||||
|
"7.5"
|
||||||
|
"8.6"
|
||||||
|
];
|
||||||
|
cudaForwardCompat = true;
|
||||||
|
|
||||||
|
# Sorted alphabetically
|
||||||
|
archNames = [
|
||||||
|
"Ampere"
|
||||||
|
"Turing"
|
||||||
|
];
|
||||||
|
|
||||||
|
realArches = [
|
||||||
|
"sm_75"
|
||||||
|
"sm_86"
|
||||||
|
];
|
||||||
|
|
||||||
|
virtualArches = [
|
||||||
|
"compute_75"
|
||||||
|
"compute_86"
|
||||||
|
];
|
||||||
|
|
||||||
|
arches = [
|
||||||
|
"sm_75"
|
||||||
|
"sm_86"
|
||||||
|
"compute_86"
|
||||||
|
];
|
||||||
|
|
||||||
|
gencode = [
|
||||||
|
"-gencode=arch=compute_75,code=sm_75"
|
||||||
|
"-gencode=arch=compute_86,code=sm_86"
|
||||||
|
"-gencode=arch=compute_86,code=compute_86"
|
||||||
|
];
|
||||||
|
|
||||||
|
gencodeString = "-gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_86,code=compute_86";
|
||||||
|
|
||||||
|
cmakeCudaArchitecturesString = "75;86";
|
||||||
|
};
|
||||||
|
actual = formatCapabilities {
|
||||||
|
inherit cudaCapabilityToInfo;
|
||||||
|
cudaCapabilities = [
|
||||||
|
"7.5"
|
||||||
|
"8.6"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
actualWrapped = (tryEval (deepSeq actual actual)).value;
|
||||||
|
in
|
||||||
|
assertMsg (expected == actualWrapped) ''
|
||||||
|
Expected: ${toJSON expected}
|
||||||
|
Actual: ${toJSON actualWrapped}
|
||||||
|
'';
|
||||||
|
runCommand "${cudaNamePrefix}-tests-flags"
|
||||||
|
{
|
||||||
|
__structuredAttrs = true;
|
||||||
|
strictDeps = true;
|
||||||
|
}
|
||||||
|
''
|
||||||
|
touch "$out"
|
||||||
|
''
|
|
@ -22,6 +22,7 @@
|
||||||
# I've (@connorbaker) attempted to do that, though I'm unsure of how this will interact with overrides.
|
# I've (@connorbaker) attempted to do that, though I'm unsure of how this will interact with overrides.
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
cudaLib,
|
||||||
cudaMajorMinorVersion,
|
cudaMajorMinorVersion,
|
||||||
lib,
|
lib,
|
||||||
newScope,
|
newScope,
|
||||||
|
@ -37,31 +38,33 @@ let
|
||||||
strings
|
strings
|
||||||
versions
|
versions
|
||||||
;
|
;
|
||||||
|
|
||||||
# MUST be defined outside fix-point (cf. "NAMESET STRICTNESS" above)
|
# MUST be defined outside fix-point (cf. "NAMESET STRICTNESS" above)
|
||||||
fixups = import ../development/cuda-modules/fixups { inherit lib; };
|
fixups = import ../development/cuda-modules/fixups { inherit lib; };
|
||||||
gpus = import ../development/cuda-modules/gpus.nix;
|
|
||||||
nvccCompatibilities = import ../development/cuda-modules/nvcc-compatibilities.nix;
|
|
||||||
flags = import ../development/cuda-modules/flags.nix {
|
|
||||||
inherit
|
|
||||||
config
|
|
||||||
cudaMajorMinorVersion
|
|
||||||
gpus
|
|
||||||
lib
|
|
||||||
stdenv
|
|
||||||
;
|
|
||||||
};
|
|
||||||
|
|
||||||
mkVersionedPackageName =
|
# Since Jetson capabilities are never built by default, we can check if any of them were requested
|
||||||
name: version: name + "_" + strings.replaceStrings [ "." ] [ "_" ] (versions.majorMinor version);
|
# through final.config.cudaCapabilities and use that to determine if we should change some manifest versions.
|
||||||
|
# Copied from backendStdenv.
|
||||||
|
jetsonCudaCapabilities = lib.filter (
|
||||||
|
cudaCapability: cudaLib.data.cudaCapabilityToInfo.${cudaCapability}.isJetson
|
||||||
|
) cudaLib.data.allSortedCudaCapabilities;
|
||||||
|
hasJetsonCudaCapability =
|
||||||
|
lib.intersectLists jetsonCudaCapabilities (config.cudaCapabilities or [ ]) != [ ];
|
||||||
|
redistSystem = cudaLib.utils.getRedistSystem hasJetsonCudaCapability stdenv.hostPlatform.system;
|
||||||
|
|
||||||
passthruFunction = final: {
|
passthruFunction = final: {
|
||||||
|
# NOTE:
|
||||||
|
# It is important that cudaLib (and fixups, which will be addressed later) are not part of the package set
|
||||||
|
# fixed-point.
|
||||||
|
# As described by @SomeoneSerge:
|
||||||
|
# > The layering should be: configuration -> (identifies/is part of) cudaPackages -> (is built using) cudaLib.
|
||||||
|
# > No arrows should point in the reverse directions.
|
||||||
|
# That is to say that cudaLib should only know about package sets and configurations, because it implements
|
||||||
|
# functionality for interpreting configurations, resolving them against data, and constructing package sets.
|
||||||
inherit
|
inherit
|
||||||
cudaMajorMinorVersion
|
cudaMajorMinorVersion
|
||||||
fixups
|
fixups
|
||||||
flags
|
|
||||||
gpus
|
|
||||||
lib
|
lib
|
||||||
nvccCompatibilities
|
|
||||||
pkgs
|
pkgs
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -71,10 +74,6 @@ let
|
||||||
cudaOlder = strings.versionOlder cudaMajorMinorVersion;
|
cudaOlder = strings.versionOlder cudaMajorMinorVersion;
|
||||||
cudaAtLeast = strings.versionAtLeast cudaMajorMinorVersion;
|
cudaAtLeast = strings.versionAtLeast cudaMajorMinorVersion;
|
||||||
|
|
||||||
# NOTE: mkVersionedPackageName is an internal, implementation detail and should not be relied on by outside consumers.
|
|
||||||
# It may be removed in the future.
|
|
||||||
inherit mkVersionedPackageName;
|
|
||||||
|
|
||||||
# Maintain a reference to the final cudaPackages.
|
# Maintain a reference to the final cudaPackages.
|
||||||
# Without this, if we use `final.callPackage` and a package accepts `cudaPackages` as an
|
# Without this, if we use `final.callPackage` and a package accepts `cudaPackages` as an
|
||||||
# argument, it's provided with `cudaPackages` from the top-level scope, which is not what we
|
# argument, it's provided with `cudaPackages` from the top-level scope, which is not what we
|
||||||
|
@ -85,6 +84,21 @@ let
|
||||||
__attrsFailEvaluation = true;
|
__attrsFailEvaluation = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
flags =
|
||||||
|
cudaLib.utils.formatCapabilities {
|
||||||
|
inherit (final.backendStdenv) cudaCapabilities cudaForwardCompat;
|
||||||
|
inherit (cudaLib.data) cudaCapabilityToInfo;
|
||||||
|
}
|
||||||
|
# TODO(@connorbaker): Enable the corresponding warnings in `../development/cuda-modules/aliases.nix` after some
|
||||||
|
# time to allow users to migrate to cudaLib and backendStdenv.
|
||||||
|
// {
|
||||||
|
inherit (cudaLib.utils) dropDots;
|
||||||
|
cudaComputeCapabilityToName =
|
||||||
|
cudaCapability: cudaLib.data.cudaCapabilityToInfo.${cudaCapability}.archName;
|
||||||
|
dropDot = cudaLib.utils.dropDots;
|
||||||
|
isJetsonBuild = final.backendStdenv.hasJetsonCudaCapability;
|
||||||
|
};
|
||||||
|
|
||||||
# Loose packages
|
# Loose packages
|
||||||
# Barring packages which share a home (e.g., cudatoolkit and cudatoolkit-legacy-runfile), new packages
|
# Barring packages which share a home (e.g., cudatoolkit and cudatoolkit-legacy-runfile), new packages
|
||||||
# should be added to ../development/cuda-modules/packages in "by-name" style, where they will be automatically
|
# should be added to ../development/cuda-modules/packages in "by-name" style, where they will be automatically
|
||||||
|
@ -131,7 +145,10 @@ let
|
||||||
value = final.callPackage ../development/cuda-modules/tests/opencv-and-torch config;
|
value = final.callPackage ../development/cuda-modules/tests/opencv-and-torch config;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
attrsets.listToAttrs (attrsets.mapCartesianProduct builder configs);
|
attrsets.listToAttrs (attrsets.mapCartesianProduct builder configs)
|
||||||
|
// {
|
||||||
|
flags = final.callPackage ../development/cuda-modules/tests/flags.nix { };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
composedExtension = fixedPoints.composeManyExtensions (
|
composedExtension = fixedPoints.composeManyExtensions (
|
||||||
|
@ -146,10 +163,10 @@ let
|
||||||
(import ../development/cuda-modules/cuda/extension.nix { inherit cudaMajorMinorVersion lib; })
|
(import ../development/cuda-modules/cuda/extension.nix { inherit cudaMajorMinorVersion lib; })
|
||||||
(import ../development/cuda-modules/generic-builders/multiplex.nix {
|
(import ../development/cuda-modules/generic-builders/multiplex.nix {
|
||||||
inherit
|
inherit
|
||||||
|
cudaLib
|
||||||
cudaMajorMinorVersion
|
cudaMajorMinorVersion
|
||||||
flags
|
|
||||||
lib
|
lib
|
||||||
mkVersionedPackageName
|
redistSystem
|
||||||
stdenv
|
stdenv
|
||||||
;
|
;
|
||||||
pname = "cudnn";
|
pname = "cudnn";
|
||||||
|
@ -159,28 +176,25 @@ let
|
||||||
})
|
})
|
||||||
(import ../development/cuda-modules/cutensor/extension.nix {
|
(import ../development/cuda-modules/cutensor/extension.nix {
|
||||||
inherit
|
inherit
|
||||||
|
cudaLib
|
||||||
cudaMajorMinorVersion
|
cudaMajorMinorVersion
|
||||||
flags
|
|
||||||
lib
|
lib
|
||||||
mkVersionedPackageName
|
redistSystem
|
||||||
stdenv
|
|
||||||
;
|
;
|
||||||
})
|
})
|
||||||
(import ../development/cuda-modules/cusparselt/extension.nix {
|
(import ../development/cuda-modules/cusparselt/extension.nix {
|
||||||
inherit
|
inherit
|
||||||
cudaMajorMinorVersion
|
cudaLib
|
||||||
flags
|
|
||||||
lib
|
lib
|
||||||
mkVersionedPackageName
|
redistSystem
|
||||||
stdenv
|
|
||||||
;
|
;
|
||||||
})
|
})
|
||||||
(import ../development/cuda-modules/generic-builders/multiplex.nix {
|
(import ../development/cuda-modules/generic-builders/multiplex.nix {
|
||||||
inherit
|
inherit
|
||||||
|
cudaLib
|
||||||
cudaMajorMinorVersion
|
cudaMajorMinorVersion
|
||||||
flags
|
|
||||||
lib
|
lib
|
||||||
mkVersionedPackageName
|
redistSystem
|
||||||
stdenv
|
stdenv
|
||||||
;
|
;
|
||||||
pname = "tensorrt";
|
pname = "tensorrt";
|
||||||
|
@ -193,7 +207,9 @@ let
|
||||||
})
|
})
|
||||||
(import ../development/cuda-modules/cuda-library-samples/extension.nix { inherit lib stdenv; })
|
(import ../development/cuda-modules/cuda-library-samples/extension.nix { inherit lib stdenv; })
|
||||||
]
|
]
|
||||||
++ lib.optionals config.allowAliases [ (import ../development/cuda-modules/aliases.nix) ]
|
++ lib.optionals config.allowAliases [
|
||||||
|
(import ../development/cuda-modules/aliases.nix { inherit lib; })
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
cudaPackages = customisation.makeScope newScope (
|
cudaPackages = customisation.makeScope newScope (
|
||||||
|
|
|
@ -14,20 +14,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
lib = import ../../lib;
|
lib = import ../../lib;
|
||||||
ensureList = x: if builtins.isList x then x else [ x ];
|
cudaLib = import ../development/cuda-modules/lib;
|
||||||
allowUnfreePredicate =
|
|
||||||
p:
|
|
||||||
builtins.all (
|
|
||||||
license:
|
|
||||||
license.free
|
|
||||||
|| builtins.elem license.shortName [
|
|
||||||
"CUDA EULA"
|
|
||||||
"cuDNN EULA"
|
|
||||||
"cuSPARSELt EULA"
|
|
||||||
"cuTENSOR EULA"
|
|
||||||
"NVidia OptiX EULA"
|
|
||||||
]
|
|
||||||
) (ensureList p.meta.license);
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -40,7 +27,7 @@ in
|
||||||
# Attributes passed to nixpkgs.
|
# Attributes passed to nixpkgs.
|
||||||
nixpkgsArgs ? {
|
nixpkgsArgs ? {
|
||||||
config = {
|
config = {
|
||||||
inherit allowUnfreePredicate;
|
allowUnfreePredicate = cudaLib.utils.allowUnfreeCudaPredicate;
|
||||||
"${variant}Support" = true;
|
"${variant}Support" = true;
|
||||||
inHydra = true;
|
inHydra = true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue