Skip to content
Closed
18 changes: 18 additions & 0 deletions pkgs/development/rocm-modules/10/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ let

rocprim = self.callPackage ./rocprim { };

rocsparse = self.callPackage ./rocsparse { };

rocthrust = self.callPackage ./rocthrust { };

rocrand = self.callPackage ./rocrand { };
Expand All @@ -121,6 +123,10 @@ let

hipcub = self.callPackage ./hipcub { };

hipsparse = self.callPackage ./hipsparse { };

hipfort = self.callPackage ./hipfort { };

hipfft = self.callPackage ./hipfft { };

tensile = pyPackages.callPackage ./tensile {
Expand All @@ -136,10 +142,22 @@ let
rocblas_base = self.callPackage ./rocblas/base.nix { };
rocblas = self.callPackage ./rocblas { };

rocsolver = self.callPackage ./rocsolver { };

rocwmma = self.callPackage ./rocwmma { };

rocalution = self.callPackage ./rocalution { };

hipsolver = self.callPackage ./hipsolver { };

hipblas-common = self.callPackage ./hipblas-common { };

hipblas = self.callPackage ./hipblas { };

hipblaslt = self.callPackage ./hipblaslt { };

hipsparselt = self.callPackage ./hipsparselt { };

half = self.callPackage ./half { };

# Even if config.rocmSupport is false we need rocmSupport true
Expand Down
135 changes: 135 additions & 0 deletions pkgs/development/rocm-modules/10/hipblas/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
lib,
stdenv,
fetchFromGitHub,
rocmUpdateScript,
cmake,
rocm-cmake,
python3,
clr,
gfortran,
hipblas-common,
rocblas,
rocsolver,
rocsparse,
rocprim,
gtest,
lapack-reference,
buildTests ? false,
buildBenchmarks ? false,
buildSamples ? false,
# for passthru.tests
hipblas,
}:

# Can also use cuBLAS
stdenv.mkDerivation (finalAttrs: {
pname = "hipblas";
version = "10.1";

outputs = [
"out"
]
++ lib.optionals buildTests [
"test"
]
++ lib.optionals buildBenchmarks [
"benchmark"
]
++ lib.optionals buildSamples [
"sample"
];

src = fetchFromGitHub {
owner = "ROCm";
repo = "rocm-libraries";
tag = "therock-${finalAttrs.version}";
sparseCheckout = [
"projects/hipblas"
"shared"
];
hash = "sha256-VUM+5qu8VK6fUbKPCVMm0PtmuZhJZYfEI6aKJEV9Vwg=";
};
sourceRoot = "${finalAttrs.src.name}/projects/hipblas";

postPatch = ''
substituteInPlace library/CMakeLists.txt \
--replace-fail "find_package(Git REQUIRED)" ""
'';

nativeBuildInputs = [
cmake
rocm-cmake
# CMakeLists.txt does find_package(Python3 REQUIRED)
python3
clr
gfortran
];

propagatedBuildInputs = [ hipblas-common ];

buildInputs = [
rocblas
rocprim
rocsparse
rocsolver
]
++ lib.optionals buildTests [
gtest
]
++ lib.optionals (buildTests || buildBenchmarks) [
lapack-reference
];

cmakeFlags = [
"-DCMAKE_CXX_COMPILER=${lib.getExe' clr "amdclang++"}"
# 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"
"-DBUILD_WITH_SOLVER=ON"
"-DAMDGPU_TARGETS=${rocblas.amdgpu_targets}"
]
++ lib.optionals buildTests [
"-DBUILD_CLIENTS_TESTS=ON"
]
++ lib.optionals buildBenchmarks [
"-DBUILD_CLIENTS_BENCHMARKS=ON"
]
++ lib.optionals buildSamples [
"-DBUILD_CLIENTS_SAMPLES=ON"
];

postInstall =
lib.optionalString buildTests ''
mkdir -p $test/bin
mv $out/bin/hipblas-test $test/bin
''
+ lib.optionalString buildBenchmarks ''
mkdir -p $benchmark/bin
mv $out/bin/hipblas-bench $benchmark/bin
''
+ lib.optionalString buildSamples ''
mkdir -p $sample/bin
mv $out/bin/example-* $sample/bin
''
+ lib.optionalString (buildTests || buildBenchmarks || buildSamples) ''
rmdir $out/bin
'';

passthru.updateScript = rocmUpdateScript { inherit finalAttrs; };
passthru.tests.hipblas-tested = hipblas.override {
buildTests = true;
buildBenchmarks = true;
buildSamples = true;
};

meta = {
description = "ROCm BLAS marshalling library";
homepage = "https://github.com/ROCm/rocm-libraries/tree/develop/projects/hipblas";
license = lib.licenses.mit;
teams = [ lib.teams.rocm ];
platforms = lib.platforms.linux;
};
})
55 changes: 55 additions & 0 deletions pkgs/development/rocm-modules/10/hipfort/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
lib,
stdenv,
fetchFromGitHub,
rocmUpdateScript,
cmake,
rocm-cmake,
gfortran,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "hipfort";
version = "10.1.0";

src = fetchFromGitHub {
owner = "ROCm";
repo = "hipfort";
tag = "rocm-${finalAttrs.version}";
hash = "sha256-/Q/wVXkJJjDSsqVRSdtMPyOw72SRDawxnyv4BY0be8g=";
};

__structuredAttrs = true;
strictDeps = true;

nativeBuildInputs = [
cmake
gfortran
];

buildInputs = [
rocm-cmake
];

cmakeFlags = [
(lib.cmakeFeature "HIPFORT_COMPILER" "${gfortran}/bin/gfortran")
(lib.cmakeFeature "HIPFORT_AR" "${gfortran.cc}/bin/gcc-ar")
(lib.cmakeFeature "HIPFORT_RANLIB" "${gfortran.cc}/bin/gcc-ranlib")
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
(lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin")
(lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
(lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include")
];

passthru.updateScript = rocmUpdateScript { inherit finalAttrs; };

meta = {
description = "Fortran interfaces for ROCm libraries";
homepage = "https://github.com/ROCm/hipfort";
changelog = "https://github.com/ROCm/hipfort/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.mit; # mitx11
teams = [ lib.teams.rocm ];
platforms = lib.platforms.linux;
};
})
123 changes: 123 additions & 0 deletions pkgs/development/rocm-modules/10/hipsolver/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
lib,
stdenv,
fetchFromGitHub,
rocmUpdateScript,
cmake,
rocm-cmake,
clr,
gfortran,
rocblas,
rocsolver,
rocsparse,
suitesparse,
gtest,
blas,
lapack,
buildTests ? false,
buildBenchmarks ? false,
buildSamples ? false,
}:

# Can also use cuSOLVER
stdenv.mkDerivation (finalAttrs: {
pname = "hipsolver";
version = "10.1";

outputs = [
"out"
]
++ lib.optionals buildTests [
"test"
]
++ lib.optionals buildBenchmarks [
"benchmark"
]
++ lib.optionals buildSamples [
"sample"
];

src = fetchFromGitHub {
owner = "ROCm";
repo = "rocm-libraries";
tag = "therock-${finalAttrs.version}";
sparseCheckout = [
"projects/hipsolver"
"shared"
];
hash = "sha256-Djncqth/JEH1ko0iVvx3WdvK2UeK/Ywuwca9y4q2Xvg=";
};
sourceRoot = "${finalAttrs.src.name}/projects/hipsolver";

nativeBuildInputs = [
cmake
rocm-cmake
clr
gfortran
];

buildInputs = [
rocblas
rocsolver
rocsparse
suitesparse
# CPU LAPACK for geev. Not lapack-reference: its ILP64 libblas.so.3 breaks
# `import torch` ("undefined symbol: cherk_64_").
blas
lapack
]
++ lib.optionals buildTests [
gtest
];

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"
"-DBUILD_WITH_SPARSE=OFF" # FIXME: broken - can't find suitesparse/cholmod, looks fixed in master
# Don't clone and build OpenBLAS at configure time.
"-DHIPSOLVER_INTERNAL_LAPACK_BUILD=OFF"
# The openblas-backed wrappers ship no LAPACKConfig.cmake.
"-DHIPSOLVER_FIND_PACKAGE_LAPACK_CONFIG=OFF"
]
++ lib.optionals buildTests [
"-DBUILD_CLIENTS_TESTS=ON"
]
++ lib.optionals buildBenchmarks [
"-DBUILD_CLIENTS_BENCHMARKS=ON"
]
++ lib.optionals buildSamples [
"-DBUILD_CLIENTS_SAMPLES=ON"
];

postInstall =
lib.optionalString buildTests ''
mkdir -p $test/bin
mv $out/bin/hipsolver-test $test/bin
''
+ lib.optionalString buildBenchmarks ''
mkdir -p $benchmark/bin
mv $out/bin/hipsolver-bench $benchmark/bin
''
+ lib.optionalString buildSamples ''
mkdir -p $sample/bin
mv clients/staging/example-* $sample/bin
patchelf $sample/bin/example-* --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE"
''
+ lib.optionalString (buildTests || buildBenchmarks) ''
rmdir $out/bin
'';

passthru.updateScript = rocmUpdateScript { inherit finalAttrs; };

meta = {
description = "ROCm SOLVER marshalling library";
homepage = "https://github.com/ROCm/rocm-libraries/tree/develop/projects/hipsolver";
license = lib.licenses.mit;
teams = [ lib.teams.rocm ];
platforms = lib.platforms.linux;
};
})
Loading