Skip to content

Commit

Permalink
Merge pull request #4420 from PhilipFackler/disallow-phdf5-for-non-mpi
Browse files Browse the repository at this point in the history
Add check for using parallel hdf5 in non-mpi build
  • Loading branch information
ye-luo authored Jan 27, 2023
2 parents b99ef57 + df21a09 commit fa62bd0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,9 @@ find_package(LibXml2 REQUIRED)
# set up HDF5 library
#-------------------------------------------------------------------
if(HAVE_MPI)
set(HDF5_PREFER_PARALLEL
TRUE
CACHE BOOL "Request parallel/serial HDF5 library")
option(HDF5_PREFER_PARALLEL "Request parallel/serial HDF5 library" ON)
else(HAVE_MPI)
set(HDF5_PREFER_PARALLEL
FALSE
CACHE BOOL "Request parallel/serial HDF5 library")
option(HDF5_PREFER_PARALLEL "Request parallel/serial HDF5 library" OFF)
if(HDF5_PREFER_PARALLEL)
message(FATAL_ERROR "Parallel HDF5 library cannot be selected with QMCPACK non-MPI build. "
"Please set HDF5_PREFER_PARALLEL=0.")
Expand All @@ -657,8 +653,13 @@ find_package(HDF5 1.10 COMPONENTS C)

if(HDF5_FOUND)
if(HDF5_IS_PARALLEL)
message(STATUS "Parallel HDF5 library found")
option(ENABLE_PHDF5 "Enable code paths using parallel HDF5" ON)
if(HAVE_MPI)
message(STATUS "Parallel HDF5 library found")
option(ENABLE_PHDF5 "Enable code paths using parallel HDF5" ON)
else(HAVE_MPI)
message(FATAL_ERROR "Parallel HDF5 library found but cannot be used with QMCPACK non-MPI build. "
"Please provide a serial HDF5 library or switch to building QMCPACK with MPI.")
endif(HAVE_MPI)
else(HDF5_IS_PARALLEL)
message(STATUS "Serial HDF5 library found")
option(ENABLE_PHDF5 "Enable code paths using parallel HDF5" OFF)
Expand Down

0 comments on commit fa62bd0

Please sign in to comment.