nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rocmUpdateScript,
6 cmake,
7 rocm-cmake,
8 rocblas,
9 rocprim,
10 rocsparse,
11 clr,
12 fmt,
13 gtest,
14 gfortran,
15 lapack-reference,
16 buildTests ? false,
17 buildBenchmarks ? false,
18 gpuTargets ? (
19 clr.localGpuTargets or [
20 "gfx900"
21 "gfx906"
22 "gfx908"
23 "gfx90a"
24 "gfx942"
25 "gfx1010"
26 "gfx1030"
27 "gfx1100"
28 "gfx1101"
29 "gfx1102"
30 "gfx1200"
31 "gfx1201"
32 ]
33 ),
34}:
35
36stdenv.mkDerivation (finalAttrs: {
37 pname = "rocsolver${clr.gpuArchSuffix}";
38 version = "6.3.3";
39
40 outputs = [
41 "out"
42 ]
43 ++ lib.optionals buildTests [
44 "test"
45 ]
46 ++ lib.optionals buildBenchmarks [
47 "benchmark"
48 ];
49
50 src = fetchFromGitHub {
51 owner = "ROCm";
52 repo = "rocSOLVER";
53 rev = "rocm-${finalAttrs.version}";
54 hash = "sha256-+sGU+0CB48iolJSyYo+xH36q5LCUp+nKtOYbguzMuhg=";
55 };
56
57 nativeBuildInputs = [
58 cmake
59 # no ninja, it buffers console output and nix times out long periods of no output
60 rocm-cmake
61 clr
62 ]
63 ++ lib.optionals (buildTests || buildBenchmarks) [
64 gfortran
65 ];
66
67 buildInputs = [
68 # FIXME: rocblas and rocsolver can't build in parallel
69 # but rocsolver doesn't need rocblas' offload builds at build time
70 # could we build against a rocblas-minimal?
71 rocblas
72 rocprim
73 rocsparse
74 fmt
75 ]
76 ++ lib.optionals buildTests [
77 gtest
78 ]
79 ++ lib.optionals (buildTests || buildBenchmarks) [
80 lapack-reference
81 ];
82
83 cmakeFlags = [
84 "-DHIP_CLANG_NUM_PARALLEL_JOBS=4"
85 "-DCMAKE_BUILD_TYPE=Release"
86 "-DCMAKE_VERBOSE_MAKEFILE=ON"
87 # Manually define CMAKE_INSTALL_<DIR>
88 # See: https://github.com/NixOS/nixpkgs/pull/197838
89 "-DCMAKE_INSTALL_BINDIR=bin"
90 "-DCMAKE_INSTALL_LIBDIR=lib"
91 "-DCMAKE_INSTALL_INCLUDEDIR=include"
92 ]
93 ++ lib.optionals (gpuTargets != [ ]) [
94 "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
95 ]
96 ++ lib.optionals buildTests [
97 "-DBUILD_CLIENTS_TESTS=ON"
98 ]
99 ++ lib.optionals buildBenchmarks [
100 "-DBUILD_CLIENTS_BENCHMARKS=ON"
101 ];
102
103 postInstall =
104 lib.optionalString buildTests ''
105 mkdir -p $test/bin
106 mv $out/bin/rocsolver-test $test/bin
107 ''
108 + lib.optionalString buildBenchmarks ''
109 mkdir -p $benchmark/bin
110 mv $out/bin/rocsolver-bench $benchmark/bin
111 ''
112 + lib.optionalString (buildTests || buildBenchmarks) ''
113 rmdir $out/bin
114 '';
115
116 passthru.updateScript = rocmUpdateScript {
117 name = "rocsolver";
118 inherit (finalAttrs.src) owner repo;
119 };
120
121 requiredSystemFeatures = [ "big-parallel" ];
122
123 meta = with lib; {
124 description = "ROCm LAPACK implementation";
125 homepage = "https://github.com/ROCm/rocSOLVER";
126 license = with licenses; [ bsd2 ];
127 teams = [ teams.rocm ];
128 platforms = platforms.linux;
129 timeout = 14400; # 4 hours
130 maxSilent = 14400; # 4 hours
131 };
132})