1{ lib, stdenv, fetchFromGitHub, autoreconfHook, doxygen, numactl
2, rdma-core, libbfd, libiberty, perl, zlib, symlinkJoin, pkg-config
3, config
4, enableCuda ? config.cudaSupport
5, cudatoolkit
6, enableRocm ? config.rocmSupport
7, rocmPackages
8}:
9
10let
11 # Needed for configure to find all libraries
12 cudatoolkit' = symlinkJoin {
13 inherit (cudatoolkit) name meta;
14 paths = [ cudatoolkit cudatoolkit.lib ];
15 };
16
17 rocmList = with rocmPackages; [ rocm-core rocm-runtime rocm-device-libs clr ];
18
19 rocm = symlinkJoin {
20 name = "rocm";
21 paths = rocmList;
22 };
23
24in
25stdenv.mkDerivation rec {
26 pname = "ucx";
27 version = "1.15.0";
28
29 src = fetchFromGitHub {
30 owner = "openucx";
31 repo = "ucx";
32 rev = "v${version}";
33 sha256 = "sha256-VxIxrk9qKM6Ncfczl4p2EhXiLNgPaYTmjhqi6/w2ZNY=";
34 };
35
36 outputs = [ "out" "doc" "dev" ];
37
38 nativeBuildInputs = [ autoreconfHook doxygen pkg-config ];
39
40 buildInputs = [
41 libbfd
42 libiberty
43 numactl
44 perl
45 rdma-core
46 zlib
47 ] ++ lib.optional enableCuda cudatoolkit
48 ++ lib.optionals enableRocm rocmList;
49
50 configureFlags = [
51 "--with-rdmacm=${lib.getDev rdma-core}"
52 "--with-dc"
53 "--with-rc"
54 "--with-dm"
55 "--with-verbs=${lib.getDev rdma-core}"
56 ] ++ lib.optional enableCuda "--with-cuda=${cudatoolkit'}"
57 ++ lib.optional enableRocm "--with-rocm=${rocm}";
58
59 postInstall = ''
60 find $out/lib/ -name "*.la" -exec rm -f \{} \;
61
62 moveToOutput bin/ucx_info $dev
63
64 moveToOutput share/ucx/examples $doc
65 '';
66
67 enableParallelBuilding = true;
68
69 meta = with lib; {
70 description = "Unified Communication X library";
71 homepage = "https://www.openucx.org";
72 license = licenses.bsd3;
73 platforms = platforms.linux;
74 maintainers = [ maintainers.markuskowa ];
75 };
76}