nixpkgs-suyu/pkgs/development/rocm-modules/5/rocsparse/default.nix
Madoura 39b6fcc8c7
rocmPackages: 5.7.0 -> 5.7.1
rocmPackages.clang-ocl: 5.7.0 -> 5.7.1

rocmPackages.hip-common: 5.7.0 -> 5.7.1

rocmPackages.half: 5.7.0 -> 5.7.1

rocmPackages.hipcc: 5.7.0 -> 5.7.1

rocmPackages.hipcub: 5.7.0 -> 5.7.1

rocmPackages.hipfft: 5.7.0 -> 5.7.1

rocmPackages.composable_kernel: 5.7.0 -> 5.7.1

rocmPackages.hipblas: 5.7.0 -> 5.7.1

rocmPackages.hiprand: 5.7.0 -> 5.7.1

rocmPackages.hipsolver: 5.7.0 -> 5.7.1

rocmPackages.hipsparse: 5.7.0 -> 5.7.1

rocmPackages.llvm.llvm: 5.7.0 -> 5.7.1

rocmPackages.migraphx: 5.7.0 -> 5.7.1

rocmPackages.hipfort: 5.7.0 -> 5.7.1

rocmPackages.miopen: 5.7.0 -> 5.7.1

rocmPackages.mivisionx: 5.7.0 -> 5.7.1

rocmPackages.hipify: 5.7.0 -> 5.7.1

rocmPackages.rocalution: 5.7.0 -> 5.7.1

rocmPackages.rocblas: 5.7.0 -> 5.7.1

rocmPackages.rdc: 5.7.0 -> 5.7.1

rocmPackages.rocfft: 5.7.0 -> 5.7.1

rocmPackages.rocgdb: 5.7.0 -> 5.7.1

rocmPackages.rccl: 5.7.0 -> 5.7.1

rocmPackages.rocm-comgr: 5.7.0 -> 5.7.1

rocmPackages.rocm-cmake: 5.7.0 -> 5.7.1

rocmPackages.rocm-device-libs: 5.7.0 -> 5.7.1

rocmPackages.rocm-runtime: 5.7.0 -> 5.7.1

rocmPackages.rocm-smi: 5.7.0 -> 5.7.1

rocmPackages.rocm-thunk: 5.7.0 -> 5.7.1

rocmPackages.rocminfo: 5.7.0 -> 5.7.1

rocmPackages.rocmlir: 5.7.0 -> 5.7.1

rocmPackages.rocdbgapi: 5.7.0 -> 5.7.1

rocmPackages.rocprim: 5.7.0 -> 5.7.1

rocmPackages.rocr-debug-agent: 5.7.0 -> 5.7.1

rocmPackages.rocsolver: 5.7.0 -> 5.7.1

rocmPackages.rocm-docs-core: 0.25.0 -> 0.26.0

rocmPackages.rocthrust: 5.7.0 -> 5.7.1

rocmPackages.rocprofiler: 5.7.0 -> 5.7.1

rocmPackages.roctracer: 5.7.0 -> 5.7.1

rocmPackages.rocsparse: 5.7.0 -> 5.7.1

rocmPackages.rpp: 5.7.0 -> 5.7.1

rocmPackages.tensile: 5.7.0 -> 5.7.1

rocmPackages.rocwmma: 5.7.0 -> 5.7.1

rocmPackages.clr: 5.7.0 -> 5.7.1
2023-10-17 15:23:30 -05:00

149 lines
4.6 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, fetchzip
, rocmUpdateScript
, cmake
, rocm-cmake
, rocprim
, clr
, gfortran
, git
, gtest
, boost
, python3Packages
, buildTests ? false
, buildBenchmarks ? false # Seems to depend on tests
, gpuTargets ? [ ]
}:
stdenv.mkDerivation (finalAttrs: {
pname = "rocsparse";
version = "5.7.1";
outputs = [
"out"
] ++ lib.optionals (buildTests || buildBenchmarks) [
"test"
] ++ lib.optionals buildBenchmarks [
"benchmark"
];
src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform";
repo = "rocSPARSE";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-30q9bqgZJUaNrkMXTAG+Z34yjsQ5DpJP+WBcCiEmF58=";
};
nativeBuildInputs = [
cmake
rocm-cmake
clr
gfortran
];
buildInputs = [
rocprim
git
] ++ lib.optionals (buildTests || buildBenchmarks) [
gtest
boost
python3Packages.python
python3Packages.pyyaml
];
cmakeFlags = [
"-DCMAKE_CXX_COMPILER=hipcc"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals (gpuTargets != [ ]) [
"-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
] ++ lib.optionals (buildTests || buildBenchmarks) [
"-DBUILD_CLIENTS_TESTS=ON"
"-DCMAKE_MATRICES_DIR=/build/source/matrices"
"-Dpython=python3"
] ++ lib.optionals buildBenchmarks [
"-DBUILD_CLIENTS_BENCHMARKS=ON"
];
# We have to manually generate the matrices
postPatch = lib.optionalString (buildTests || buildBenchmarks) ''
mkdir -p matrices
ln -s ${finalAttrs.passthru.matrices.matrix-01}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-02}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-03}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-04}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-05}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-06}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-07}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-08}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-09}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-10}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-11}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-12}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-13}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-14}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-15}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-16}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-17}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-18}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-19}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-20}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-21}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-22}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-23}/*.mtx matrices
ln -s ${finalAttrs.passthru.matrices.matrix-24}/*.mtx matrices
# Not used by the original cmake, causes an error
rm matrices/*_b.mtx
echo "deps/convert.cpp -> deps/mtx2csr"
hipcc deps/convert.cpp -O3 -o deps/mtx2csr
for mat in $(ls -1 matrices | cut -d "." -f 1); do
echo "mtx2csr: $mat.mtx -> $mat.csr"
deps/mtx2csr matrices/$mat.mtx matrices/$mat.csr
unlink matrices/$mat.mtx
done
'';
postInstall = lib.optionalString buildBenchmarks ''
mkdir -p $benchmark/bin
cp -a $out/bin/* $benchmark/bin
rm $benchmark/bin/rocsparse-test
'' + lib.optionalString (buildTests || buildBenchmarks) ''
mkdir -p $test/bin
mv $out/bin/* $test/bin
rm $test/bin/rocsparse-bench || true
mv /build/source/matrices $test
rmdir $out/bin
'';
passthru = {
matrices = import ./deps.nix {
inherit fetchzip;
mirror1 = "https://sparse.tamu.edu/MM";
mirror2 = "https://www.cise.ufl.edu/research/sparse/MM";
};
updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
};
meta = with lib; {
description = "ROCm SPARSE implementation";
homepage = "https://github.com/ROCmSoftwarePlatform/rocSPARSE";
license = with licenses; [ mit ];
maintainers = teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
})