Skip to content

Enable building hipSOLVER clients #320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions math-libs/BLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ if(THEROCK_ENABLE_SOLVER)
# hipSOLVER
##############################################################################

set(hipSOLVER_optional_deps)
if(THEROCK_BUILD_TESTING)
list(APPEND hipSOLVER_optional_deps therock-host-blas)
endif()

therock_cmake_subproject_declare(hipSOLVER
EXTERNAL_SOURCE_DIR "hipSOLVER"
BACKGROUND_BUILD
Expand All @@ -237,9 +242,9 @@ if(THEROCK_ENABLE_SOLVER)
# BUILD_WITH_SPARSE converts rocsparse and cholmod to build time vs
# runtime/dlopen deps.
-DBUILD_WITH_SPARSE=ON
# Requires LAPACK
-DBUILD_CLIENTS_BENCHMARKS=OFF
-DBUILD_CLIENTS_TESTS=OFF
-DBUILD_CLIENTS_BENCHMARKS=${THEROCK_BUILD_TESTING}
-DBUILD_CLIENTS_TESTS=${THEROCK_BUILD_TESTING}
-DHIPSOLVER_FIND_PACKAGE_LAPACK_CONFIG=OFF
COMPILER_TOOLCHAIN
amd-hip
RUNTIME_DEPS
Expand All @@ -248,6 +253,7 @@ if(THEROCK_ENABLE_SOLVER)
rocSOLVER
rocSPARSE
therock-SuiteSparse
${hipSOLVER_optional_deps}
)
therock_cmake_subproject_glob_c_sources(hipSOLVER
SUBDIRS
Expand Down
11 changes: 11 additions & 0 deletions math-libs/BLAS/artifact-blas.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ optional = true
[components.doc."math-libs/BLAS/hipSOLVER/stage"]
optional = true
[components.lib."math-libs/BLAS/hipSOLVER/stage"]
exclude = [
"lib/libhipsolver_fortran.so",
]
optional = true
[components.test."math-libs/BLAS/hipSOLVER/stage"]
include = [
"bin/hipsolver-bench",
"bin/hipsolver-test",
"lib/libhipsolver_fortran.so",
"share/hipsolver/test/**",
]
optional = true

# rocSPARSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From e1ebcf4389094357894b72eb89290be951e9177c Mon Sep 17 00:00:00 2001
From: Marius Brehler <[email protected]>
Date: Mon, 31 Mar 2025 22:24:41 +0000
Subject: [PATCH 1/2] Work around race condition

With `add_dependency`, compiling the `hipsolver_fortran_client` target
fails as `hipsolver.mod` is not created in time for the first build
attempt. A second run passes. Using `target_link_libraries` resovles
this.
---
clients/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt
index d715fd2..2590d85 100644
--- a/clients/CMakeLists.txt
+++ b/clients/CMakeLists.txt
@@ -76,7 +76,7 @@ endif()
if(BUILD_CLIENTS_TESTS OR BUILD_CLIENTS_BENCHMARKS)
if(BUILD_FORTRAN_BINDINGS)
add_library(hipsolver_fortran_client STATIC ${hipsolver_f90_source_clients})
- add_dependencies(hipsolver_fortran_client hipsolver_fortran)
+ target_link_libraries(hipsolver_fortran_client hipsolver_fortran)
include_directories(${CMAKE_BINARY_DIR}/include/hipsolver)
include_directories(${CMAKE_BINARY_DIR}/include/hipsolver/internal)
target_compile_definitions(hipsolver_fortran_client INTERFACE HAVE_HIPSOLVER_FORTRAN_CLIENT)
--
2.43.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 084297f8d3771a83084fa2718589c8f8e68f7676 Mon Sep 17 00:00:00 2001
From: Marius Brehler <[email protected]>
Date: Tue, 1 Apr 2025 14:41:28 +0000
Subject: [PATCH 2/2] Install `hipsolver_client.so`

This is required by the test and benchmark clients but was not part of
the installation so far.
---
library/src/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt
index c1ec52d..a4e8649 100644
--- a/library/src/CMakeLists.txt
+++ b/library/src/CMakeLists.txt
@@ -75,6 +75,7 @@ set(hipsolver_f90_source
if(BUILD_FORTRAN_BINDINGS)
# Create hipSOLVER Fortran module
add_library(hipsolver_fortran ${hipsolver_f90_source})
+ rocm_install(TARGETS hipsolver_fortran)
endif()

add_library(hipsolver
--
2.43.0

Loading