fixed: remove HYPRE from prereqs

this is controlled by USE_HYPRE and we should not unconditionally
look for it. had to move the code into config hook and split some ifs

pointy hat [at]akva2
This commit is contained in:
Arne Morten Kvarving 2024-12-11 12:08:24 +01:00
parent 61b7b0c113
commit 3eeb33d8c8
3 changed files with 28 additions and 24 deletions

View File

@ -289,6 +289,20 @@ if(OpenCL_FOUND)
endif() endif()
endif() endif()
if(USE_HYPRE AND USE_MPI)
find_package(HYPRE)
if(HYPRE_FOUND)
set(HAVE_HYPRE 1)
list(APPEND opm-simulators_LIBRARIES HYPRE::HYPRE)
else()
message(WARNING "Hypre requested but not found. Continuing without Hypre support.")
set(USE_HYPRE OFF)
endif()
elseif(USE_HYPRE)
message(WARNING "Hypre requested but MPI not activated. Continuing without Hypre support.")
set(USE_HYPRE OFF)
set(HYPRE_FOUND OFF)
endif()
macro (config_hook) macro (config_hook)
opm_need_version_of ("dune-common") opm_need_version_of ("dune-common")
@ -396,6 +410,12 @@ macro (files_hook)
endmacro (files_hook) endmacro (files_hook)
macro (tests_hook) macro (tests_hook)
if(HYPRE_FOUND)
list(APPEND tests_SOURCES tests/test_HyprePreconditionerCPU.cpp)
if(HYPRE_USING_CUDA OR HYPRE_USING_HIP)
list(APPEND tests_SOURCES tests/test_HyprePreconditionerGPU.cpp)
endif()
endif()
endmacro (tests_hook) endmacro (tests_hook)
@ -692,6 +712,14 @@ if(CUDA_FOUND)
PROPERTIES LABELS ${gpu_label}) PROPERTIES LABELS ${gpu_label})
endif() endif()
if(HYPRE_FOUND)
if (HYPRE_USING_CUDA)
set_tests_properties(HyprePreconditionerGPU PROPERTIES LABELS gpu_cuda)
elseif (HYPRE_USING_HIP)
set_tests_properties(HyprePreconditionerGPU PROPERTIES LABELS gpu_hip)
endif()
endif()
if(USE_GPU_BRIDGE) if(USE_GPU_BRIDGE)
if(OpenCL_FOUND) if(OpenCL_FOUND)
target_link_libraries( opmsimulators PUBLIC ${OpenCL_LIBRARIES} ) target_link_libraries( opmsimulators PUBLIC ${OpenCL_LIBRARIES} )
@ -722,18 +750,3 @@ endif()
install(DIRECTORY doc/man1 DESTINATION ${CMAKE_INSTALL_MANDIR} install(DIRECTORY doc/man1 DESTINATION ${CMAKE_INSTALL_MANDIR}
FILES_MATCHING PATTERN "*.1") FILES_MATCHING PATTERN "*.1")
if(USE_HYPRE)
find_package(HYPRE)
if(HYPRE_FOUND)
set(HAVE_HYPRE 1)
target_link_libraries(opmsimulators PUBLIC HYPRE::HYPRE)
if (HYPRE_USING_CUDA)
set_tests_properties(HyprePreconditionerGPU PROPERTIES LABELS gpu_cuda)
elseif (HYPRE_USING_HIP)
set_tests_properties(HyprePreconditionerGPU PROPERTIES LABELS gpu_hip)
endif()
else()
message(WARNING "Hypre requested but not found. Continuing without Hypre support.")
set(USE_HYPRE OFF)
endif()
endif()

View File

@ -492,13 +492,6 @@ if(HDF5_FOUND)
list(APPEND TEST_SOURCE_FILES tests/test_HDF5Serializer.cpp) list(APPEND TEST_SOURCE_FILES tests/test_HDF5Serializer.cpp)
endif() endif()
if(HYPRE_FOUND)
list(APPEND TEST_SOURCE_FILES tests/test_HyprePreconditionerCPU.cpp)
if(HYPRE_USING_CUDA OR HYPRE_USING_HIP)
list(APPEND TEST_SOURCE_FILES tests/test_HyprePreconditionerGPU.cpp)
endif()
endif()
list (APPEND TEST_DATA_FILES list (APPEND TEST_DATA_FILES
tests/equil_base.DATA tests/equil_base.DATA
tests/equil_capillary.DATA tests/equil_capillary.DATA

View File

@ -57,8 +57,6 @@ set (opm-simulators_DEPS
# packages from ROCm framework # packages from ROCm framework
"rocblas" "rocblas"
"rocsparse" "rocsparse"
# HYPRE solver library
"HYPRE"
# OPM dependency # OPM dependency
"opm-common REQUIRED" "opm-common REQUIRED"
"opm-grid REQUIRED" "opm-grid REQUIRED"