Skip to content

Commit

Permalink
fixed: look up HYPRE_USING_CUDA and HYPRE_USING_HIP (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
akva2 authored Dec 4, 2024
1 parent 07fe2eb commit d071b0c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions cmake/Modules/FindHYPRE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,21 @@ find_package(BLAS QUIET REQUIRED)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HYPRE
REQUIRED_VARS
HYPRE_LIBRARY
HYPRE_INCLUDE_DIRS)
REQUIRED_VARS
HYPRE_LIBRARY
HYPRE_INCLUDE_DIRS)

if(HYPRE_FOUND AND NOT TARGET HYPRE::HYPRE)
file(STRINGS ${HYPRE_INCLUDE_DIRS}/HYPRE_config.h HYPRE_CONFIG)
string(FIND "${HYPRE_CONFIG}" "#define HYPRE_USING_CUDA" CUDA_POS)
if(NOT CUDA_POS EQUAL -1)
set(HYPRE_USING_CUDA ON)
endif()
string(FIND "${HYPRE_CONFIG}" "#define HYPRE_USING_HIP" HIP_POS)
if(NOT HIP_POS EQUAL -1)
set(HYPRE_USING_HIP ON)
endif()

add_library(HYPRE::HYPRE UNKNOWN IMPORTED GLOBAL)
set_target_properties(HYPRE::HYPRE PROPERTIES
IMPORTED_LOCATION "${HYPRE_LIBRARY}"
Expand Down Expand Up @@ -80,4 +90,4 @@ if(HYPRE_FOUND AND NOT TARGET HYPRE::HYPRE)
roc::rocblas)
message(STATUS "HYPRE was built with HIP support")
endif()
endif()
endif()

0 comments on commit d071b0c

Please sign in to comment.