about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix b/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix
new file mode 100644
index 000000000000..5036ad890799
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/science/math/nccl/default.nix
@@ -0,0 +1,48 @@
+{ lib, stdenv, fetchFromGitHub, which, cudatoolkit, addOpenGLRunpath }:
+
+stdenv.mkDerivation rec {
+  name = "nccl-${version}-cuda-${cudatoolkit.majorVersion}";
+  version = "2.7.8-1";
+
+  src = fetchFromGitHub {
+    owner = "NVIDIA";
+    repo = "nccl";
+    rev = "v${version}";
+    sha256 = "0xxiwaw239dc9g015fka3k1nvm5zyl00dzgxnwzkang61dys9wln";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ which addOpenGLRunpath ];
+
+  buildInputs = [ cudatoolkit ];
+
+  preConfigure = ''
+    patchShebangs src/collectives/device/gen_rules.sh
+  '';
+
+  makeFlags = [
+    "CUDA_HOME=${cudatoolkit}"
+    "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
+  '';
+
+  NIX_CFLAGS_COMPILE = [ "-Wno-unused-function" ];
+
+  enableParallelBuilding = true;
+
+  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 ];
+  };
+}