FTI may use sequential HDF5 implementation
christoph-conrads opened this issue · 0 comments
When enabling HDF5 support, FTI may find and attempt to use sequential HDF5 library versions (i.e., HDF5 without MPI support). In this case, there will be compiler warnings (see below) and linking will fail because functions like H5Pset_fapl_mpio()
cannot be found.
This problem can be fixed by requiring CMake 3.4 and asking the CMake HDF5 module to search for a parallel implementation. I am not sure if this always works but it works on Ubuntu 18 LTS where the parallel HDF5 library uses OpenMPI. The necessary changes can be found in the attached file. Apply the changes with git apply
, e.g., git apply ~/fti-hdf5-mpi.patch
(Warning: GitHub may destroy the necessary formatting of the file):
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 69d23c10..0e9d5f10 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
@@ -317,8 +317,12 @@ endif()
if(ENABLE_HDF5)
+ set(HDF5_PREFER_PARALLEL ON)
find_package(HDF5 COMPONENTS HL C REQUIRED)
if(HDF5_FOUND)
+ if(NOT HDF5_IS_PARALLEL)
+ message(FATAL_ERROR "Serial HDF5 found but HDF5 with MPI needed")
+ endif()
add_definitions(-DENABLE_HDF5)
include_directories(${HDF5_INCLUDE_DIRS})
message("Here are the HDF5 include directories: ${HDF5_INCLUDE_DIRS}")
CMake output with patch, with sequential HDF5:
$ cmake -DENABLE_HDF5=ON -- ~/fti
[snip]
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.0.1") found components: HL C
CMake Error at CMakeLists.txt:324 (message):
Serial HDF5 found but HDF5 with MPI needed
Example warning without patch, with sequential HDF5
[ 20%] Building C object CMakeFiles/fti.shared.dir/src/IO/hdf5-fti.c.o
/home/christoph/fti/src/IO/hdf5-fti.c: In function ‘FTI_HDF5Open’:
/home/christoph/fti/src/IO/hdf5-fti.c:417:9: warning: implicit declaration of function ‘H5Pset_fapl_mpio’; did you mean ‘H5Pset_fapl_stdio’? [-Wimplicit-function-declaration]
H5Pset_fapl_mpio(plid, FTI_COMM_WORLD, MPI_INFO_NULL);
^~~~~~~~~~~~~~~~
H5Pset_fapl_stdio
/home/christoph/fti/src/IO/hdf5-fti.c: In function ‘FTI_ReadSharedFileData’:
/home/christoph/fti/src/IO/hdf5-fti.c:1656:5: warning: implicit declaration of function ‘H5Pset_dxpl_mpio’; did you mean ‘H5Pset_fapl_stdio’? [-Wimplicit-function-declaration]
H5Pset_dxpl_mpio(plid, H5FD_MPIO_COLLECTIVE);
^~~~~~~~~~~~~~~~
H5Pset_fapl_stdio
Linker error without patch, with sequential HDF5
[ 62%] Linking C executable hd2.exe
../lib/libfti.a(api.c.o): In function `FTI_RecoverDatasetDimension':
api.c:(.text+0x29e0): undefined reference to `H5Pset_fapl_mpio'
../lib/libfti.a(hdf5-fti.c.o): In function `FTI_HDF5Open':
hdf5-fti.c:(.text+0x132e): undefined reference to `H5Pset_fapl_mpio'
../lib/libfti.a(hdf5-fti.c.o): In function `FTI_RecoverHDF5':
hdf5-fti.c:(.text+0x352a): undefined reference to `H5Pset_fapl_mpio'
../lib/libfti.a(hdf5-fti.c.o): In function `FTI_RecoverVarInitHDF5':
hdf5-fti.c:(.text+0x3bac): undefined reference to `H5Pset_fapl_mpio'
../lib/libfti.a(hdf5-fti.c.o): In function `FTI_ReadSharedFileData':
hdf5-fti.c:(.text+0x4719): undefined reference to `H5Pset_dxpl_mpio'
../lib/libfti.a(hdf5-fti.c.o): In function `FTI_WriteSharedFileData':
hdf5-fti.c:(.text+0x4a46): undefined reference to `H5Pset_dxpl_mpio'
../lib/libfti.a(hdf5-fti.c.o): In function `FTI_MergeDatasetSingleFile':
hdf5-fti.c:(.text+0x5efb): undefined reference to `H5Pset_dxpl_mpio'
../lib/libfti.a(hdf5-fti.c.o): In function `FTI_FlushH5SingleFile':
hdf5-fti.c:(.text+0x681c): undefined reference to `H5Pset_fapl_mpio'
collect2: error: ld returned 1 exit status
examples/CMakeFiles/hd2.exe.dir/build.make:109: recipe for target 'examples/hd2.exe' failed