3
0
Fork 0
forked from mirrors/nixpkgs

hipsparse: fixup samples

This commit is contained in:
Madoura 2022-12-18 21:15:54 -06:00
parent 8de23957e9
commit 8e80bc7dd2
No known key found for this signature in database
GPG key ID: 3201136B3DB072F9
2 changed files with 14 additions and 0 deletions

View file

@ -9,7 +9,9 @@
, gfortran
, git
, gtest
, openmp
, buildTests ? false
, buildSamples ? false
}:
# This can also use cuSPARSE as a backend instead of rocSPARSE
@ -21,6 +23,8 @@ stdenv.mkDerivation (finalAttrs: {
"out"
] ++ lib.optionals buildTests [
"test"
] ++ lib.optionals buildSamples [
"sample"
];
src = fetchFromGitHub {
@ -42,10 +46,14 @@ stdenv.mkDerivation (finalAttrs: {
git
] ++ lib.optionals buildTests [
gtest
] ++ lib.optionals (buildTests || buildSamples) [
openmp
];
cmakeFlags = [
"-DCMAKE_C_COMPILER=hipcc"
"-DCMAKE_CXX_COMPILER=hipcc"
"-DBUILD_CLIENTS_SAMPLES=${if buildSamples then "ON" else "OFF"}"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
@ -104,6 +112,11 @@ stdenv.mkDerivation (finalAttrs: {
mv $out/bin/hipsparse-test $test/bin
mv /build/source/matrices $test
rmdir $out/bin
'' + lib.optionalString buildSamples ''
mkdir -p $sample/bin
mv clients/staging/example_* $sample/bin
patchelf --set-rpath $out/lib:${lib.makeLibraryPath (
finalAttrs.buildInputs ++ [ hip gfortran.cc ])} $sample/bin/example_*
'';
passthru.updateScript = rocmUpdateScript {

View file

@ -15180,6 +15180,7 @@ with pkgs;
};
hipsparse = callPackage ../development/libraries/hipsparse {
inherit (llvmPackages_rocm) openmp;
stdenv = rocmClangStdenv;
};