blob: 155e863bf21e402a5c6428c0f9e5019657546540 (
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
|
{ lib
, backendStdenv
, fetchFromGitHub
, which
, cudaPackages ? { }
, addOpenGLRunpath
}:
with cudaPackages;
let
# Output looks like "-gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_86,code=compute_86"
gencode = lib.concatStringsSep " " cudaFlags.gencode;
in
backendStdenv.mkDerivation rec {
name = "nccl-${version}-cuda-${cudaPackages.cudaMajorVersion}";
version = "2.16.5-1";
src = fetchFromGitHub {
owner = "NVIDIA";
repo = "nccl";
rev = "v${version}";
hash = "sha256-JyhhYKSVIqUKIbC1rCJozPT1IrIyRLGrTjdPjJqsYaU=";
};
outputs = [ "out" "dev" ];
nativeBuildInputs = [
which
addOpenGLRunpath
cuda_nvcc
];
buildInputs = [
cuda_cudart
] ++ lib.optionals (lib.versionAtLeast cudaVersion "12.0.0") [
cuda_cccl
];
preConfigure = ''
patchShebangs src/collectives/device/gen_rules.sh
makeFlagsArray+=(
"NVCC_GENCODE=${gencode}"
)
'';
makeFlags = [
"CUDA_HOME=${cuda_nvcc}"
"CUDA_LIB=${cuda_cudart}/lib64"
"CUDA_INC=${cuda_cudart}/include"
"PREFIX=$(out)"
];
postFixup = ''
moveToOutput lib/libnccl_static.a $dev
# Set RUNPATH so that libnvidia-ml in /run/opengl-driver(-32)/lib can be found.
# See the explanation in addOpenGLRunpath.
addOpenGLRunpath $out/lib/lib*.so
'';
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-unused-function" ];
enableParallelBuilding = true;
passthru = {
inherit cudaPackages;
};
meta = with lib; {
description = "Multi-GPU and multi-node collective communication primitives for NVIDIA GPUs";
homepage = "https://developer.nvidia.com/nccl";
license = licenses.bsd3;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ mdaiter orivej ];
};
}
|