nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 buildRedist,
3 lib,
4 libcublas,
5 mpi,
6 nccl,
7}:
8buildRedist {
9 redistName = "cudss";
10 pname = "libcudss";
11
12 outputs = [
13 "out"
14 "dev"
15 "include"
16 "lib"
17 "static"
18 ];
19
20 buildInputs = [
21 libcublas
22 ]
23 # MPI brings in NCCL dependency by way of UCC/UCX.
24 ++ lib.optionals nccl.meta.available [
25 mpi
26 nccl
27 ];
28
29 # Update the CMake configurations
30 postFixup = ''
31 pushd "''${!outputDev:?}/lib/cmake/cudss" >/dev/null
32
33 nixLog "patching $PWD/cudss-config.cmake to fix relative paths"
34 substituteInPlace "$PWD/cudss-config.cmake" \
35 --replace-fail \
36 'get_filename_component(PACKAGE_PREFIX_DIR "''${CMAKE_CURRENT_LIST_DIR}/../../../../" ABSOLUTE)' \
37 "" \
38 --replace-fail \
39 'file(REAL_PATH "../../" _cudss_search_prefix BASE_DIRECTORY "''${_cudss_cmake_config_realpath}")' \
40 "set(_cudss_search_prefix \"''${!outputDev:?}/lib;''${!outputLib:?}/lib;''${!outputInclude:?}/include\")"
41
42 nixLog "patching $PWD/cudss-static-targets.cmake to fix INTERFACE_LINK_DIRECTORIES for cublas"
43 sed -Ei \
44 's|INTERFACE_LINK_DIRECTORIES "/usr/local/cuda.*/lib64"|INTERFACE_LINK_DIRECTORIES "${lib.getLib libcublas}/lib"|g' \
45 "$PWD/cudss-static-targets.cmake"
46 if grep -Eq 'INTERFACE_LINK_DIRECTORIES "/usr/local/cuda.*/lib64"' "$PWD/cudss-static-targets.cmake"; then
47 nixErrorLog "failed to patch $PWD/cudss-static-targets.cmake"
48 exit 1
49 fi
50
51 nixLog "patching $PWD/cudss-static-targets-release.cmake to fix the path to the static library"
52 substituteInPlace "$PWD/cudss-static-targets-release.cmake" \
53 --replace-fail \
54 '"''${cudss_LIBRARY_DIR}/libcudss_static.a"' \
55 "\"''${!outputStatic:?}/lib/libcudss_static.a\""
56
57 popd >/dev/null
58 '';
59
60 meta = {
61 description = "Library of GPU-accelerated linear solvers with sparse matrices";
62 longDescription = ''
63 NVIDIA cuDSS (Preview) is a library of GPU-accelerated linear solvers with sparse matrices.
64 '';
65 homepage = "https://developer.nvidia.com/cudss";
66 changelog = "https://docs.nvidia.com/cuda/cudss/release_notes.html";
67 };
68}