blob: ff462b4cc970b2005037e62ac19b660cb167d9be (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
{cudaVersion, lib}:
let
inherit (lib) attrsets lists strings;
# cudaVersionOlder : Version -> Boolean
cudaVersionOlder = strings.versionOlder cudaVersion;
# cudaVersionAtLeast : Version -> Boolean
cudaVersionAtLeast = strings.versionAtLeast cudaVersion;
addBuildInputs =
drv: buildInputs:
drv.overrideAttrs (prevAttrs: {buildInputs = prevAttrs.buildInputs ++ buildInputs;});
in
# NOTE: Filter out attributes that are not present in the previous version of
# the package set. This is necessary to prevent the appearance of attributes
# like `cuda_nvcc` in `cudaPackages_10_0, which predates redistributables.
final: prev:
attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
libcufile = prev.libcufile.overrideAttrs (
prevAttrs: {
buildInputs = prevAttrs.buildInputs ++ [
final.libcublas.lib
final.pkgs.numactl
final.pkgs.rdma-core
];
# Before 11.7 libcufile depends on itself for some reason.
env.autoPatchelfIgnoreMissingDeps =
prevAttrs.env.autoPatchelfIgnoreMissingDeps
+ strings.optionalString (cudaVersionOlder "11.7") " libcufile.so.0";
}
);
libcusolver = addBuildInputs prev.libcusolver (
# Always depends on this
[final.libcublas.lib]
# Dependency from 12.0 and on
++ lists.optionals (cudaVersionAtLeast "12.0") [final.libnvjitlink.lib]
# Dependency from 12.1 and on
++ lists.optionals (cudaVersionAtLeast "12.1") [final.libcusparse.lib]
);
libcusparse = addBuildInputs prev.libcusparse (
lists.optionals (cudaVersionAtLeast "12.0") [final.libnvjitlink.lib]
);
cuda_compat = prev.cuda_compat.overrideAttrs (
prevAttrs: {
env.autoPatchelfIgnoreMissingDeps =
prevAttrs.env.autoPatchelfIgnoreMissingDeps + " libnvrm_gpu.so libnvrm_mem.so libnvdla_runtime.so";
# `cuda_compat` only works on aarch64-linux, and only when building for Jetson devices.
brokenConditions = prevAttrs.brokenConditions // {
"Trying to use cuda_compat on aarch64-linux targeting non-Jetson devices" =
!final.flags.isJetsonBuild;
};
}
);
cuda_gdb = addBuildInputs prev.cuda_gdb (
# x86_64 only needs gmp from 12.0 and on
lists.optionals (cudaVersionAtLeast "12.0") [final.pkgs.gmp]
);
cuda_nvcc = prev.cuda_nvcc.overrideAttrs (
oldAttrs: {
outputs = oldAttrs.outputs ++ [ "lib" ];
postPatch =
(oldAttrs.postPatch or "")
+ ''
substituteInPlace bin/nvcc.profile \
--replace \
'$(TOP)/lib' \
"''${!outputLib}/lib"
cat << EOF >> bin/nvcc.profile
LIBRARIES += "-L''${!outputBin}/nvvm/lib" "-L$static/lib" "-L${final.cuda_cudart.lib}/lib" "-L${final.cuda_cudart.lib}/lib/stubs"
INCLUDES += "-I''${!outputDev}/include" "-I''${!outputBin}/nvvm/include" "-I${final.cuda_cudart.dev}/include"
EOF
'';
propagatedBuildInputs = [ final.setupCudaHook ];
postInstall =
(oldAttrs.postInstall or "")
+ ''
moveToOutput "nvvm" "''${!outputBin}"
'';
meta = (oldAttrs.meta or {}) // {
mainProgram = "nvcc";
};
}
);
cuda_nvprof = prev.cuda_nvprof.overrideAttrs (
prevAttrs: {buildInputs = prevAttrs.buildInputs ++ [final.cuda_cupti.lib];}
);
cuda_demo_suite = addBuildInputs prev.cuda_demo_suite [
final.pkgs.freeglut
final.pkgs.libGLU
final.pkgs.libglvnd
final.pkgs.mesa
final.libcufft.lib
final.libcurand.lib
];
nsight_compute = prev.nsight_compute.overrideAttrs (
prevAttrs: {
nativeBuildInputs =
prevAttrs.nativeBuildInputs
++ (
if (strings.versionOlder prev.nsight_compute.version "2022.2.0") then
[final.pkgs.qt5.wrapQtAppsHook]
else
[final.pkgs.qt6.wrapQtAppsHook]
);
buildInputs =
prevAttrs.buildInputs
++ (
if (strings.versionOlder prev.nsight_compute.version "2022.2.0") then
[final.pkgs.qt5.qtwebview]
else
[final.pkgs.qt6.qtwebview]
);
}
);
nsight_systems = prev.nsight_systems.overrideAttrs (
prevAttrs: {
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [final.pkgs.qt5.wrapQtAppsHook];
buildInputs = prevAttrs.buildInputs ++ [
final.pkgs.alsa-lib
final.pkgs.e2fsprogs
final.pkgs.nss
final.pkgs.numactl
final.pkgs.pulseaudio
final.pkgs.wayland
final.pkgs.xorg.libXcursor
final.pkgs.xorg.libXdamage
final.pkgs.xorg.libXrandr
final.pkgs.xorg.libXtst
];
}
);
nvidia_driver = prev.nvidia_driver.overrideAttrs {
# No need to support this package as we have drivers already
# in linuxPackages.
meta.broken = true;
};
}
|