about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/ucx/default.nix
blob: 3b923d8efdd2a874cac001d330d3a6e9cf63a347 (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
{ lib, stdenv, fetchFromGitHub, autoreconfHook, doxygen, numactl
, rdma-core, libbfd, libiberty, perl, zlib, symlinkJoin, pkg-config
, config
, enableCuda ? config.cudaSupport
, cudaPackages
, enableRocm ? config.rocmSupport
, rocmPackages
}:

let
  rocmList = with rocmPackages; [ rocm-core rocm-runtime rocm-device-libs clr ];

  rocm = symlinkJoin {
    name = "rocm";
    paths = rocmList;
  };

in
stdenv.mkDerivation rec {
  pname = "ucx";
  version = "1.15.0";

  src = fetchFromGitHub {
    owner = "openucx";
    repo = "ucx";
    rev = "v${version}";
    sha256 = "sha256-VxIxrk9qKM6Ncfczl4p2EhXiLNgPaYTmjhqi6/w2ZNY=";
  };

  outputs = [ "out" "doc" "dev" ];

  nativeBuildInputs = [
    autoreconfHook
    doxygen
    pkg-config
  ]
  ++ lib.optionals enableCuda [
    cudaPackages.cuda_nvcc
    cudaPackages.autoAddOpenGLRunpathHook
  ];

  buildInputs = [
    libbfd
    libiberty
    numactl
    perl
    rdma-core
    zlib
  ] ++ lib.optionals enableCuda [
    cudaPackages.cuda_cudart
    cudaPackages.cuda_nvml_dev

  ] ++ lib.optionals enableRocm rocmList;

  LDFLAGS = lib.optionals enableCuda [
    # Fake libnvidia-ml.so (the real one is deployed impurely)
    "-L${cudaPackages.cuda_nvml_dev}/lib/stubs"
  ];

  configureFlags = [
    "--with-rdmacm=${lib.getDev rdma-core}"
    "--with-dc"
    "--with-rc"
    "--with-dm"
    "--with-verbs=${lib.getDev rdma-core}"
  ] ++ lib.optionals enableCuda [ "--with-cuda=${cudaPackages.cuda_cudart}" ]
  ++ lib.optional enableRocm "--with-rocm=${rocm}";

  postInstall = ''
    find $out/lib/ -name "*.la" -exec rm -f \{} \;

    moveToOutput bin/ucx_info $dev

    moveToOutput share/ucx/examples $doc
  '';

  enableParallelBuilding = true;

  meta = with lib; {
    description = "Unified Communication X library";
    homepage = "https://www.openucx.org";
    license = licenses.bsd3;
    platforms = platforms.linux;
    maintainers = [ maintainers.markuskowa ];
  };
}