From 5f97b147d153c63386431b30c2e7d7c73b1db0e3 Mon Sep 17 00:00:00 2001 From: Philip Fackler Date: Fri, 27 Jan 2023 12:44:49 -0500 Subject: [PATCH 1/2] Add check for using parallel hdf5 in non-mpi build Added check for when MPI is disabled but the parallel hdf5 library was found. This results in an error due to incompatibility. --- CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8654f9884..4eb111f2a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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.") @@ -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 serial HDF5 library.") + endif(HAVE_MPI) else(HDF5_IS_PARALLEL) message(STATUS "Serial HDF5 library found") option(ENABLE_PHDF5 "Enable code paths using parallel HDF5" OFF) From df21a097b3e4649435679a70a50f01ebfa3e19d6 Mon Sep 17 00:00:00 2001 From: "Paul R. C. Kent" Date: Fri, 27 Jan 2023 13:23:38 -0500 Subject: [PATCH 2/2] Additional explanation --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4eb111f2a5..85f4034660 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -658,7 +658,7 @@ if(HDF5_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 serial HDF5 library.") + "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")