Skip to content

Commit

Permalink
Upgrade CMake for HIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pghysels committed Jun 23, 2023
1 parent 94f8f3a commit ae8d241
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 33 deletions.
62 changes: 29 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.21)
project(STRUMPACK VERSION 7.1.3 LANGUAGES CXX C Fortran)
cmake_policy(SET CMP0074 NEW)

Expand Down Expand Up @@ -112,20 +112,14 @@ if(STRUMPACK_USE_HIP)
" proceeding with CUDA support instead of HIP.")
set(STRUMPACK_USE_HIP OFF)
else()
find_package(HIP MODULE)
if(HIP_FOUND)
set(STRUMPACK_HIP_PLATFORM_HCC ON)
find_package(hipblas REQUIRED)
find_package(hipsparse REQUIRED)
find_package(rocsolver REQUIRED)
find_package(rocblas REQUIRED)
find_package(rocprim REQUIRED)
find_package(rocthrust REQUIRED)
else()
message(WARNING "HIP compiler not found,"
" proceeding without HIP support.")
set(STRUMPACK_USE_HIP OFF)
endif()
enable_language(HIP)
find_package(hip REQUIRED)
find_package(hipblas REQUIRED)
find_package(hipsparse REQUIRED)
find_package(rocsolver REQUIRED)
find_package(rocblas REQUIRED)
find_package(rocprim REQUIRED)
find_package(rocthrust REQUIRED)
endif()
endif()

Expand Down Expand Up @@ -520,24 +514,26 @@ if(TPL_ENABLE_COMBBLAS)
endif()
endif()

if(STRUMPACK_USE_HIP)
set_source_files_properties(
src/sparse/fronts/FrontalMatrixHIP.hip.cpp
src/dense/HIPWrapper.hip.cpp
PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
if(BUILD_SHARED_LIBS)
set(STATIC_OR_SHARED SHARED)
else()
set(STATIC_OR_SHARED STATIC)
endif()
hip_add_library(
strumpack
src/sparse/fronts/FrontalMatrixHIP.hip.cpp
src/dense/HIPWrapper.hip.cpp
${STATIC_OR_SHARED})
else()
add_library(strumpack "")
endif()
# if(STRUMPACK_USE_HIP)
# set_source_files_properties(
# src/sparse/fronts/FrontalMatrixHIP.hip.cpp
# src/dense/HIPWrapper.hip.cpp
# PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
# if(BUILD_SHARED_LIBS)
# set(STATIC_OR_SHARED SHARED)
# else()
# set(STATIC_OR_SHARED STATIC)
# endif()
# hip_add_library(
# strumpack
# src/sparse/fronts/FrontalMatrixHIP.hip.cpp
# src/dense/HIPWrapper.hip.cpp
# ${STATIC_OR_SHARED})
# else()
# add_library(strumpack "")
# endif()

add_library(strumpack "")

# this is to fix a link issue for the fortran example when compiling
# with clang
Expand Down
1 change: 1 addition & 0 deletions src/dense/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
target_sources(strumpack
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/HIPWrapper.hip
${CMAKE_CURRENT_LIST_DIR}/BLASLAPACKWrapper.cpp
${CMAKE_CURRENT_LIST_DIR}/BLASLAPACKOpenMPTask.cpp
${CMAKE_CURRENT_LIST_DIR}/ACA.hpp
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/sparse/fronts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
target_sources(strumpack
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/FrontalMatrixHIP.hip
${CMAKE_CURRENT_LIST_DIR}/FrontFactory.cpp
${CMAKE_CURRENT_LIST_DIR}/FrontalMatrix.cpp
${CMAKE_CURRENT_LIST_DIR}/FrontalMatrixDense.cpp
Expand Down
File renamed without changes.

0 comments on commit ae8d241

Please sign in to comment.