mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
_cuda: introduce to organize CUDA package set backbone
Signed-off-by: Connor Baker <ConnorBaker01@gmail.com>
This commit is contained in:
parent
8fcff2390e
commit
688e14d21a
45 changed files with 186 additions and 156 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}
|
||||
|
||||
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 `cudaCapabilityToInfo` in `pkgs/development/cuda-modules/lib/data/cuda.nix` to include any new GPUs supported by the new release of CUDA.
|
||||
1. Update `nvccCompatibilities` in `pkgs/development/cuda-modules/_cuda/data/nvcc.nix` to include the newest release of NVCC, as well as any newly supported host compilers.
|
||||
2. Update `cudaCapabilityToInfo` in `pkgs/development/cuda-modules/_cuda/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}
|
||||
|
||||
|
|
|
@ -1,63 +1,5 @@
|
|||
{ cudaLib, lib }:
|
||||
{ lib }:
|
||||
{
|
||||
/**
|
||||
All CUDA capabilities, sorted by version.
|
||||
|
||||
NOTE: Since the capabilities are sorted by version and architecture/family-specific features are
|
||||
appended to the minor version component, the sorted list groups capabilities by baseline feature
|
||||
set.
|
||||
|
||||
# Type
|
||||
|
||||
```
|
||||
allSortedCudaCapabilities :: [CudaCapability]
|
||||
```
|
||||
|
||||
# Example
|
||||
|
||||
```
|
||||
allSortedCudaCapabilities = [
|
||||
"5.0"
|
||||
"5.2"
|
||||
"6.0"
|
||||
"6.1"
|
||||
"7.0"
|
||||
"7.2"
|
||||
"7.5"
|
||||
"8.0"
|
||||
"8.6"
|
||||
"8.7"
|
||||
"8.9"
|
||||
"9.0"
|
||||
"9.0a"
|
||||
"10.0"
|
||||
"10.0a"
|
||||
"10.0f"
|
||||
"10.1"
|
||||
"10.1a"
|
||||
"10.1f"
|
||||
"10.3"
|
||||
"10.3a"
|
||||
"10.3f"
|
||||
];
|
||||
```
|
||||
*/
|
||||
allSortedCudaCapabilities = lib.sort lib.versionOlder (
|
||||
lib.attrNames cudaLib.data.cudaCapabilityToInfo
|
||||
);
|
||||
|
||||
/**
|
||||
Mapping of CUDA micro-architecture name to capabilities belonging to that micro-architecture.
|
||||
|
||||
# Type
|
||||
|
||||
```
|
||||
cudaArchNameToCapabilities :: AttrSet NonEmptyStr (NonEmptyListOf CudaCapability)
|
||||
```
|
||||
*/
|
||||
cudaArchNameToCapabilities = lib.groupBy (
|
||||
cudaCapability: cudaLib.data.cudaCapabilityToInfo.${cudaCapability}.archName
|
||||
) cudaLib.data.allSortedCudaCapabilities;
|
||||
|
||||
/**
|
||||
Attribute set of supported CUDA capability mapped to information about that capability.
|
|
@ -1,9 +1,7 @@
|
|||
{ cudaLib, lib }:
|
||||
{ lib }:
|
||||
{
|
||||
# See ./cuda.nix for documentation.
|
||||
inherit (import ./cuda.nix { inherit cudaLib lib; })
|
||||
allSortedCudaCapabilities
|
||||
cudaArchNameToCapabilities
|
||||
inherit (import ./cuda.nix { inherit lib; })
|
||||
cudaCapabilityToInfo
|
||||
;
|
||||
|
||||
|
@ -28,5 +26,5 @@
|
|||
cudaPackagesPath :: Path
|
||||
```
|
||||
*/
|
||||
cudaPackagesPath = ./..;
|
||||
cudaPackagesPath = ./../../..;
|
||||
}
|
65
pkgs/development/cuda-modules/_cuda/db/default.nix
Normal file
65
pkgs/development/cuda-modules/_cuda/db/default.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
lib,
|
||||
bootstrapData,
|
||||
db,
|
||||
}:
|
||||
|
||||
bootstrapData
|
||||
// {
|
||||
/**
|
||||
All CUDA capabilities, sorted by version.
|
||||
|
||||
NOTE: Since the capabilities are sorted by version and architecture/family-specific features are
|
||||
appended to the minor version component, the sorted list groups capabilities by baseline feature
|
||||
set.
|
||||
|
||||
# Type
|
||||
|
||||
```
|
||||
allSortedCudaCapabilities :: [CudaCapability]
|
||||
```
|
||||
|
||||
# Example
|
||||
|
||||
```
|
||||
allSortedCudaCapabilities = [
|
||||
"5.0"
|
||||
"5.2"
|
||||
"6.0"
|
||||
"6.1"
|
||||
"7.0"
|
||||
"7.2"
|
||||
"7.5"
|
||||
"8.0"
|
||||
"8.6"
|
||||
"8.7"
|
||||
"8.9"
|
||||
"9.0"
|
||||
"9.0a"
|
||||
"10.0"
|
||||
"10.0a"
|
||||
"10.0f"
|
||||
"10.1"
|
||||
"10.1a"
|
||||
"10.1f"
|
||||
"10.3"
|
||||
"10.3a"
|
||||
"10.3f"
|
||||
];
|
||||
```
|
||||
*/
|
||||
allSortedCudaCapabilities = lib.sort lib.versionOlder (lib.attrNames db.cudaCapabilityToInfo);
|
||||
|
||||
/**
|
||||
Mapping of CUDA micro-architecture name to capabilities belonging to that micro-architecture.
|
||||
|
||||
# Type
|
||||
|
||||
```
|
||||
cudaArchNameToCapabilities :: AttrSet NonEmptyStr (NonEmptyListOf CudaCapability)
|
||||
```
|
||||
*/
|
||||
cudaArchNameToCapabilities = lib.groupBy (
|
||||
cudaCapability: db.cudaCapabilityToInfo.${cudaCapability}.archName
|
||||
) db.allSortedCudaCapabilities;
|
||||
}
|
30
pkgs/development/cuda-modules/_cuda/default.nix
Normal file
30
pkgs/development/cuda-modules/_cuda/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
# The _cuda attribute set is a fixed-point which contains the static functionality required to construct CUDA package
|
||||
# sets. For example, `_cuda.cudaData` includes information about NVIDIA's redistributables (such as the names NVIDIA
|
||||
# uses for different systems), `_cuda.cudaLib` contains utility functions like `formatCapabilities` (which generate
|
||||
# common arguments passed to NVCC and `cmakeFlags`), and `_cuda.cudaFixups` contains `callPackage`-able functions
|
||||
# which are provided to the corresponding package's `overrideAttrs` attribute to provide package-specific fixups
|
||||
# out of scope of the generic redistributable builder.
|
||||
#
|
||||
# Since this attribute set is used to construct the CUDA package sets, it must exist outside the fixed point of the
|
||||
# package sets. Make these attributes available directly in the package set construction could cause confusion if
|
||||
# users override the attribute set with the expection that changes will be reflected in the enclosing CUDA package
|
||||
# set. To avoid this, we declare `_cuda` and inherit its members here, at top-level. (This also allows us to benefit
|
||||
# from import caching, as it should be evaluated once per system, rather than per-system and CUDA package set.)
|
||||
|
||||
let
|
||||
lib = import ../../../../lib;
|
||||
in
|
||||
lib.fixedPoints.makeExtensible (final: {
|
||||
bootstrapData = import ./db/bootstrap {
|
||||
inherit lib;
|
||||
};
|
||||
db = import ./db {
|
||||
inherit (final) bootstrapData db;
|
||||
inherit lib;
|
||||
};
|
||||
fixups = import ./fixups { inherit lib; };
|
||||
lib = import ./lib {
|
||||
_cuda = final;
|
||||
inherit lib;
|
||||
};
|
||||
})
|
|
@ -1,6 +1,4 @@
|
|||
let
|
||||
lib = import ../../../../lib;
|
||||
in
|
||||
{ lib }:
|
||||
lib.concatMapAttrs (
|
||||
fileName: _type:
|
||||
let
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
cudaLib,
|
||||
_cuda,
|
||||
cudaOlder,
|
||||
cudaPackages,
|
||||
cudaMajorMinorVersion,
|
||||
|
@ -103,7 +103,7 @@ finalAttrs: prevAttrs: {
|
|||
# unless it is not available, in which case the default cudnn derivation will be used.
|
||||
cudnn =
|
||||
let
|
||||
desiredName = cudaLib.utils.mkVersionedName "cudnn" (
|
||||
desiredName = _cuda.lib.mkVersionedName "cudnn" (
|
||||
lib.versions.majorMinor finalAttrs.passthru.featureRelease.cudnnVersion
|
||||
);
|
||||
in
|
|
@ -1,4 +1,4 @@
|
|||
{ cudaLib, lib }:
|
||||
{ _cuda, lib }:
|
||||
{
|
||||
/**
|
||||
Evaluate assertions and add error context to return value.
|
||||
|
@ -16,7 +16,7 @@
|
|||
_evaluateAssertions =
|
||||
assertions:
|
||||
let
|
||||
failedAssertionsString = cudaLib.utils._mkFailedAssertionsString assertions;
|
||||
failedAssertionsString = _cuda.lib._mkFailedAssertionsString assertions;
|
||||
in
|
||||
if failedAssertionsString == "" then
|
||||
true
|
||||
|
@ -45,7 +45,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils._mkFailedAssertionsString` usage examples
|
||||
## `_cuda.lib._mkFailedAssertionsString` usage examples
|
||||
|
||||
```nix
|
||||
_mkFailedAssertionsString [
|
||||
|
@ -103,7 +103,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils._mkMissingPackagesAssertions` usage examples
|
||||
## `_cuda.lib._mkMissingPackagesAssertions` usage examples
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -114,7 +114,7 @@
|
|||
}:
|
||||
let
|
||||
inherit (lib.attrsets) recursiveUpdate;
|
||||
inherit (cudaLib.utils) _mkMissingPackagesAssertions;
|
||||
inherit (_cuda.lib) _mkMissingPackagesAssertions;
|
||||
in
|
||||
prevAttrs: {
|
||||
passthru = prevAttrs.passthru or { } // {
|
|
@ -92,7 +92,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils._mkCudaVariant` usage examples
|
||||
## `_cuda.lib._mkCudaVariant` usage examples
|
||||
|
||||
```nix
|
||||
_mkCudaVariant "11.0"
|
|
@ -1,7 +1,10 @@
|
|||
{ cudaLib, lib }:
|
||||
{
|
||||
_cuda,
|
||||
lib,
|
||||
}:
|
||||
{
|
||||
# See ./assertions.nix for documentation.
|
||||
inherit (import ./assertions.nix { inherit cudaLib lib; })
|
||||
inherit (import ./assertions.nix { inherit _cuda lib; })
|
||||
_evaluateAssertions
|
||||
_mkFailedAssertionsString
|
||||
_mkMissingPackagesAssertions
|
||||
|
@ -16,13 +19,13 @@
|
|||
;
|
||||
|
||||
# See ./meta.nix for documentation.
|
||||
inherit (import ./meta.nix { inherit cudaLib lib; })
|
||||
inherit (import ./meta.nix { inherit _cuda lib; })
|
||||
_mkMetaBadPlatforms
|
||||
_mkMetaBroken
|
||||
;
|
||||
|
||||
# See ./redist.nix for documentation.
|
||||
inherit (import ./redist.nix { inherit cudaLib lib; })
|
||||
inherit (import ./redist.nix { inherit _cuda lib; })
|
||||
_redistSystemIsSupported
|
||||
getNixSystems
|
||||
getRedistSystem
|
||||
|
@ -30,7 +33,7 @@
|
|||
;
|
||||
|
||||
# See ./strings.nix for documentation.
|
||||
inherit (import ./strings.nix { inherit cudaLib lib; })
|
||||
inherit (import ./strings.nix { inherit _cuda lib; })
|
||||
dotsToUnderscores
|
||||
dropDots
|
||||
formatCapabilities
|
||||
|
@ -42,7 +45,7 @@
|
|||
;
|
||||
|
||||
# See ./versions.nix for documentation.
|
||||
inherit (import ./versions.nix { inherit cudaLib lib; })
|
||||
inherit (import ./versions.nix { inherit _cuda lib; })
|
||||
majorMinorPatch
|
||||
trimComponents
|
||||
;
|
|
@ -1,4 +1,4 @@
|
|||
{ cudaLib, lib }:
|
||||
{ _cuda, lib }:
|
||||
{
|
||||
/**
|
||||
Returns a list of bad platforms for a given package if assertsions in `finalAttrs.passthru.platformAssertions`
|
||||
|
@ -18,7 +18,7 @@
|
|||
_mkMetaBadPlatforms =
|
||||
warn: finalAttrs:
|
||||
let
|
||||
failedAssertionsString = cudaLib.utils._mkFailedAssertionsString finalAttrs.passthru.platformAssertions;
|
||||
failedAssertionsString = _cuda.lib._mkFailedAssertionsString finalAttrs.passthru.platformAssertions;
|
||||
hasFailedAssertions = failedAssertionsString != "";
|
||||
finalStdenv = finalAttrs.finalPackage.stdenv;
|
||||
in
|
||||
|
@ -62,7 +62,7 @@
|
|||
_mkMetaBroken =
|
||||
warn: finalAttrs:
|
||||
let
|
||||
failedAssertionsString = cudaLib.utils._mkFailedAssertionsString finalAttrs.passthru.brokenAssertions;
|
||||
failedAssertionsString = _cuda.lib._mkFailedAssertionsString finalAttrs.passthru.brokenAssertions;
|
||||
hasFailedAssertions = failedAssertionsString != "";
|
||||
in
|
||||
lib.warnIf (warn && hasFailedAssertions)
|
|
@ -1,4 +1,4 @@
|
|||
{ cudaLib, lib }:
|
||||
{ _cuda, lib }:
|
||||
{
|
||||
/**
|
||||
Returns a boolean indicating whether the provided redist system is supported by any of the provided redist systems.
|
||||
|
@ -27,7 +27,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils._redistSystemIsSupported` usage examples
|
||||
## `cudaLib._redistSystemIsSupported` usage examples
|
||||
|
||||
```nix
|
||||
_redistSystemIsSupported "linux-x86_64" [ "linux-x86_64" ]
|
||||
|
@ -81,7 +81,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.getNixSystems` usage examples
|
||||
## `cudaLib.getNixSystems` usage examples
|
||||
|
||||
```nix
|
||||
getNixSystems "linux-sbsa"
|
||||
|
@ -137,7 +137,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.getRedistSystem` usage examples
|
||||
## `cudaLib.getRedistSystem` usage examples
|
||||
|
||||
```nix
|
||||
getRedistSystem true "aarch64-linux"
|
||||
|
@ -181,7 +181,7 @@
|
|||
mkRedistUrl =
|
||||
redistName: relativePath:
|
||||
lib.concatStringsSep "/" (
|
||||
[ cudaLib.data.redistUrlPrefix ]
|
||||
[ _cuda.db.redistUrlPrefix ]
|
||||
++ (
|
||||
if redistName != "tensorrt" then
|
||||
[
|
|
@ -1,4 +1,7 @@
|
|||
{ cudaLib, lib }:
|
||||
{ _cuda, lib }:
|
||||
let
|
||||
cudaLib = _cuda.lib;
|
||||
in
|
||||
{
|
||||
/**
|
||||
Replaces dots in a string with underscores.
|
||||
|
@ -18,7 +21,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.dotsToUnderscores` usage examples
|
||||
## `cudaLib.dotsToUnderscores` usage examples
|
||||
|
||||
```nix
|
||||
dotsToUnderscores "1.2.3"
|
||||
|
@ -46,7 +49,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.dropDots` usage examples
|
||||
## `cudaLib.dropDots` usage examples
|
||||
|
||||
```nix
|
||||
dropDots "1.2.3"
|
||||
|
@ -110,7 +113,7 @@
|
|||
realArches :: List String
|
||||
```
|
||||
*/
|
||||
realArches = lib.map cudaLib.utils.mkRealArchitecture cudaCapabilities;
|
||||
realArches = lib.map cudaLib.mkRealArchitecture cudaCapabilities;
|
||||
|
||||
/**
|
||||
The virtual architectures for the given CUDA capabilities.
|
||||
|
@ -124,7 +127,7 @@
|
|||
virtualArches :: List String
|
||||
```
|
||||
*/
|
||||
virtualArches = lib.map cudaLib.utils.mkVirtualArchitecture cudaCapabilities;
|
||||
virtualArches = lib.map cudaLib.mkVirtualArchitecture cudaCapabilities;
|
||||
|
||||
/**
|
||||
The gencode flags for the given CUDA capabilities.
|
||||
|
@ -137,8 +140,8 @@
|
|||
*/
|
||||
gencode =
|
||||
let
|
||||
base = lib.map (cudaLib.utils.mkGencodeFlag "sm") cudaCapabilities;
|
||||
forward = cudaLib.utils.mkGencodeFlag "compute" (lib.last cudaCapabilities);
|
||||
base = lib.map (cudaLib.mkGencodeFlag "sm") cudaCapabilities;
|
||||
forward = cudaLib.mkGencodeFlag "compute" (lib.last cudaCapabilities);
|
||||
in
|
||||
base ++ lib.optionals cudaForwardCompat [ forward ];
|
||||
in
|
||||
|
@ -190,7 +193,7 @@
|
|||
cmakeCudaArchitecturesString :: String
|
||||
```
|
||||
*/
|
||||
cmakeCudaArchitecturesString = cudaLib.utils.mkCmakeCudaArchitecturesString cudaCapabilities;
|
||||
cmakeCudaArchitecturesString = cudaLib.mkCmakeCudaArchitecturesString cudaCapabilities;
|
||||
|
||||
/**
|
||||
The gencode string for the given CUDA capabilities.
|
||||
|
@ -222,7 +225,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.mkCmakeCudaArchitecturesString` usage examples
|
||||
## `cudaLib.mkCmakeCudaArchitecturesString` usage examples
|
||||
|
||||
```nix
|
||||
mkCmakeCudaArchitecturesString [ "8.9" "10.0a" ]
|
||||
|
@ -230,7 +233,7 @@
|
|||
```
|
||||
:::
|
||||
*/
|
||||
mkCmakeCudaArchitecturesString = lib.concatMapStringsSep ";" cudaLib.utils.dropDots;
|
||||
mkCmakeCudaArchitecturesString = lib.concatMapStringsSep ";" cudaLib.dropDots;
|
||||
|
||||
/**
|
||||
Produces a gencode flag from a CUDA capability.
|
||||
|
@ -254,7 +257,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.mkGencodeFlag` usage examples
|
||||
## `cudaLib.mkGencodeFlag` usage examples
|
||||
|
||||
```nix
|
||||
mkGencodeFlag "sm" "8.9"
|
||||
|
@ -270,7 +273,7 @@
|
|||
mkGencodeFlag =
|
||||
archPrefix: cudaCapability:
|
||||
let
|
||||
cap = cudaLib.utils.dropDots cudaCapability;
|
||||
cap = cudaLib.dropDots cudaCapability;
|
||||
in
|
||||
"-gencode=arch=compute_${cap},code=${archPrefix}_${cap}";
|
||||
|
||||
|
@ -292,7 +295,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.mkRealArchitecture` usage examples
|
||||
## `cudaLib.mkRealArchitecture` usage examples
|
||||
|
||||
```nix
|
||||
mkRealArchitecture "8.9"
|
||||
|
@ -305,7 +308,7 @@
|
|||
```
|
||||
:::
|
||||
*/
|
||||
mkRealArchitecture = cudaCapability: "sm_" + cudaLib.utils.dropDots cudaCapability;
|
||||
mkRealArchitecture = cudaCapability: "sm_" + cudaLib.dropDots cudaCapability;
|
||||
|
||||
/**
|
||||
Create a versioned attribute name from a version by replacing dots with underscores.
|
||||
|
@ -329,7 +332,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.mkVersionedName` usage examples
|
||||
## `cudaLib.mkVersionedName` usage examples
|
||||
|
||||
```nix
|
||||
mkVersionedName "hello" "1.2.3"
|
||||
|
@ -342,7 +345,7 @@
|
|||
```
|
||||
:::
|
||||
*/
|
||||
mkVersionedName = name: version: "${name}_${cudaLib.utils.dotsToUnderscores version}";
|
||||
mkVersionedName = name: version: "${name}_${cudaLib.dotsToUnderscores version}";
|
||||
|
||||
/**
|
||||
Produces a virtual architecture string from a CUDA capability.
|
||||
|
@ -362,7 +365,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.mkVirtualArchitecture` usage examples
|
||||
## `cudaLib.mkVirtualArchitecture` usage examples
|
||||
|
||||
```nix
|
||||
mkVirtualArchitecture "8.9"
|
||||
|
@ -375,5 +378,5 @@
|
|||
```
|
||||
:::
|
||||
*/
|
||||
mkVirtualArchitecture = cudaCapability: "compute_" + cudaLib.utils.dropDots cudaCapability;
|
||||
mkVirtualArchitecture = cudaCapability: "compute_" + cudaLib.dropDots cudaCapability;
|
||||
}
|
|
@ -1,4 +1,7 @@
|
|||
{ cudaLib, lib }:
|
||||
{ _cuda, lib }:
|
||||
let
|
||||
cudaLib = _cuda.lib;
|
||||
in
|
||||
{
|
||||
/**
|
||||
Extracts the major, minor, and patch version from a string.
|
||||
|
@ -18,7 +21,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.majorMinorPatch` usage examples
|
||||
## `_cuda.lib.majorMinorPatch` usage examples
|
||||
|
||||
```nix
|
||||
majorMinorPatch "11.0.3.4"
|
||||
|
@ -26,7 +29,7 @@
|
|||
```
|
||||
:::
|
||||
*/
|
||||
majorMinorPatch = cudaLib.utils.trimComponents 3;
|
||||
majorMinorPatch = cudaLib.trimComponents 3;
|
||||
|
||||
/**
|
||||
Get a version string with no more than than the specified number of components.
|
||||
|
@ -48,7 +51,7 @@
|
|||
# Examples
|
||||
|
||||
:::{.example}
|
||||
## `cudaLib.utils.trimComponents` usage examples
|
||||
## `_cuda.lib.trimComponents` usage examples
|
||||
|
||||
```nix
|
||||
trimComponents 1 "1.2.3.4"
|
|
@ -69,7 +69,7 @@ let
|
|||
# Patch version changes should not break the build, so we only use major and minor
|
||||
# computeName :: RedistribRelease -> String
|
||||
computeName =
|
||||
{ version, ... }: cudaLib.utils.mkVersionedName redistName (lib.versions.majorMinor version);
|
||||
{ version, ... }: cudaLib.mkVersionedName redistName (lib.versions.majorMinor version);
|
||||
in
|
||||
final: _:
|
||||
let
|
||||
|
|
|
@ -108,7 +108,7 @@ let
|
|||
# Patch version changes should not break the build, so we only use major and minor
|
||||
# computeName :: RedistribRelease -> String
|
||||
computeName =
|
||||
{ version, ... }: cudaLib.utils.mkVersionedName redistName (lib.versions.majorMinor version);
|
||||
{ version, ... }: cudaLib.mkVersionedName redistName (lib.versions.majorMinor version);
|
||||
in
|
||||
final: _:
|
||||
let
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
autoPatchelfHook,
|
||||
backendStdenv,
|
||||
callPackage,
|
||||
cudaFixups,
|
||||
cudaLib,
|
||||
_cuda,
|
||||
fetchurl,
|
||||
lib,
|
||||
markForCudatoolkitRootHook,
|
||||
|
@ -45,7 +44,7 @@ let
|
|||
# Last step before returning control to `callPackage` (adds the `.override` method)
|
||||
# we'll apply (`overrideAttrs`) necessary package-specific "fixup" functions.
|
||||
# Order is significant.
|
||||
maybeFixup = cudaFixups.${pname} or null;
|
||||
maybeFixup = _cuda.fixups.${pname} or null;
|
||||
fixup = if maybeFixup != null then callPackage maybeFixup { } else { };
|
||||
|
||||
# Get the redist systems for which package provides distributables.
|
||||
|
@ -54,9 +53,9 @@ let
|
|||
# redistSystem :: String
|
||||
# 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 system.
|
||||
redistSystem = cudaLib.utils.getRedistSystem backendStdenv.hasJetsonCudaCapability hostPlatform.system;
|
||||
redistSystem = _cuda.lib.getRedistSystem backendStdenv.hasJetsonCudaCapability hostPlatform.system;
|
||||
|
||||
sourceMatchesHost = lib.elem hostPlatform.system (cudaLib.utils.getNixSystems redistSystem);
|
||||
sourceMatchesHost = lib.elem hostPlatform.system (_cuda.lib.getNixSystems redistSystem);
|
||||
in
|
||||
(backendStdenv.mkDerivation (finalAttrs: {
|
||||
# NOTE: Even though there's no actual buildPhase going on here, the derivations of the
|
||||
|
@ -327,7 +326,7 @@ in
|
|||
broken = lists.any trivial.id (attrsets.attrValues finalAttrs.brokenConditions);
|
||||
platforms = trivial.pipe supportedRedistSystems [
|
||||
# Map each redist system to the equivalent nix systems.
|
||||
(lib.concatMap cudaLib.utils.getNixSystems)
|
||||
(lib.concatMap _cuda.lib.getNixSystems)
|
||||
# Take all the unique values.
|
||||
lib.unique
|
||||
# Sort the list.
|
||||
|
|
|
@ -64,8 +64,7 @@ let
|
|||
# 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
|
||||
# computeName :: Package -> String
|
||||
computeName =
|
||||
{ version, ... }: cudaLib.utils.mkVersionedName pname (lib.versions.majorMinor version);
|
||||
computeName = { version, ... }: cudaLib.mkVersionedName pname (lib.versions.majorMinor version);
|
||||
|
||||
# The newest package for each major-minor version, with newest first.
|
||||
# newestPackages :: List Package
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
let
|
||||
lib = import ../../../../lib;
|
||||
in
|
||||
lib.fixedPoints.makeExtensible (final: {
|
||||
data = import ./data {
|
||||
inherit lib;
|
||||
cudaLib = final;
|
||||
};
|
||||
utils = import ./utils {
|
||||
inherit lib;
|
||||
cudaLib = final;
|
||||
};
|
||||
})
|
|
@ -7,7 +7,7 @@
|
|||
# Cf. https://github.com/NixOS/nixpkgs/pull/218265 for context
|
||||
{
|
||||
config,
|
||||
cudaLib,
|
||||
_cuda,
|
||||
cudaMajorMinorVersion,
|
||||
lib,
|
||||
pkgs,
|
||||
|
@ -16,8 +16,8 @@
|
|||
}:
|
||||
let
|
||||
inherit (builtins) toJSON;
|
||||
inherit (cudaLib.data) allSortedCudaCapabilities cudaCapabilityToInfo nvccCompatibilities;
|
||||
inherit (cudaLib.utils)
|
||||
inherit (_cuda.db) allSortedCudaCapabilities cudaCapabilityToInfo nvccCompatibilities;
|
||||
inherit (_cuda.lib)
|
||||
_cudaCapabilityIsDefault
|
||||
_cudaCapabilityIsSupported
|
||||
_evaluateAssertions
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
cudaData,
|
||||
cudaLib,
|
||||
cudaNamePrefix,
|
||||
lib,
|
||||
|
@ -6,8 +7,8 @@
|
|||
}:
|
||||
let
|
||||
inherit (builtins) deepSeq toJSON tryEval;
|
||||
inherit (cudaLib.data) cudaCapabilityToInfo;
|
||||
inherit (cudaLib.utils) formatCapabilities;
|
||||
inherit (cudaData) cudaCapabilityToInfo;
|
||||
inherit (cudaLib) formatCapabilities;
|
||||
inherit (lib.asserts) assertMsg;
|
||||
in
|
||||
# When changing names or formats: pause, validate, and update the assert
|
||||
|
|
|
@ -2719,9 +2719,8 @@ with pkgs;
|
|||
|
||||
cron = isc-cron;
|
||||
|
||||
cudaLib = import ../development/cuda-modules/lib;
|
||||
|
||||
cudaFixups = import ../development/cuda-modules/fixups;
|
||||
# Top-level fix-point used in `cudaPackages`' internals
|
||||
_cuda = import ../development/cuda-modules/_cuda;
|
||||
|
||||
cudaPackages_11_0 = callPackage ./cuda-packages.nix { cudaMajorMinorVersion = "11.0"; };
|
||||
cudaPackages_11_1 = callPackage ./cuda-packages.nix { cudaMajorMinorVersion = "11.1"; };
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# I've (@connorbaker) attempted to do that, though I'm unsure of how this will interact with overrides.
|
||||
{
|
||||
config,
|
||||
cudaLib,
|
||||
_cuda,
|
||||
cudaMajorMinorVersion,
|
||||
lib,
|
||||
newScope,
|
||||
|
@ -38,25 +38,28 @@ let
|
|||
versions
|
||||
;
|
||||
|
||||
cudaLib = _cuda.lib;
|
||||
|
||||
# Since Jetson capabilities are never built by default, we can check if any of them were requested
|
||||
# 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;
|
||||
cudaCapability: _cuda.db.cudaCapabilityToInfo.${cudaCapability}.isJetson
|
||||
) _cuda.db.allSortedCudaCapabilities;
|
||||
hasJetsonCudaCapability =
|
||||
lib.intersectLists jetsonCudaCapabilities (config.cudaCapabilities or [ ]) != [ ];
|
||||
redistSystem = cudaLib.utils.getRedistSystem hasJetsonCudaCapability stdenv.hostPlatform.system;
|
||||
redistSystem = _cuda.lib.getRedistSystem hasJetsonCudaCapability stdenv.hostPlatform.system;
|
||||
|
||||
passthruFunction = final: {
|
||||
# NOTE:
|
||||
# It is important that cudaLib and cudaFixups are not part of the package set fixed-point. As described by
|
||||
# It is important that _cuda is 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.
|
||||
# This decision is driven both by a separation of concerns and by "NAMESET STRICTNESS" (see above).
|
||||
# Also see the comment in `pkgs/top-level/all-packages.nix` about the `_cuda` attribute.
|
||||
|
||||
inherit cudaMajorMinorVersion;
|
||||
|
||||
|
@ -77,17 +80,17 @@ let
|
|||
};
|
||||
|
||||
flags =
|
||||
cudaLib.utils.formatCapabilities {
|
||||
cudaLib.formatCapabilities {
|
||||
inherit (final.backendStdenv) cudaCapabilities cudaForwardCompat;
|
||||
inherit (cudaLib.data) cudaCapabilityToInfo;
|
||||
inherit (_cuda.db) 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;
|
||||
inherit (cudaLib) dropDots;
|
||||
cudaComputeCapabilityToName =
|
||||
cudaCapability: cudaLib.data.cudaCapabilityToInfo.${cudaCapability}.archName;
|
||||
dropDot = cudaLib.utils.dropDots;
|
||||
cudaCapability: _cuda.db.cudaCapabilityToInfo.${cudaCapability}.archName;
|
||||
dropDot = cudaLib.dropDots;
|
||||
isJetsonBuild = final.backendStdenv.hasJetsonCudaCapability;
|
||||
};
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
let
|
||||
lib = import ../../lib;
|
||||
cudaLib = import ../development/cuda-modules/lib;
|
||||
inherit (import ../development/cuda-modules/_cuda) cudaLib;
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ in
|
|||
# Attributes passed to nixpkgs.
|
||||
nixpkgsArgs ? {
|
||||
config = {
|
||||
allowUnfreePredicate = cudaLib.utils.allowUnfreeCudaPredicate;
|
||||
allowUnfreePredicate = cudaLib.allowUnfreeCudaPredicate;
|
||||
"${variant}Support" = true;
|
||||
inHydra = true;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue