F2I-Consulting / fesapi

API for ENERGISTICS™ data standards (mainly RESQML™), multi-languages (C++, Java, C#, Python)
Apache License 2.0
34 stars 24 forks source link

use parallel HDF5 library but not use parallel functionality #328

Closed corppeon closed 9 months ago

corppeon commented 1 year ago

Our app currently uses the parallel HDF5 library.

When moving to v2.8 of FESAPI, I initially got a link error with my app until I built FESAPI with the HDF_PREFER_PARALLEL flag set to True (linker complained of missing HdfProxyMPI virtual table)

Now, I'm seeing issues with interference between my app MPI functionality and FESAPI use of MPI when it writes a representation.

Is it possible to disable FESAPI from using parallel functionality when linking to a parallel enabled HDF5 library?

corppeon commented 1 year ago

I've found a way if it helps anyone. Set MPIcomm to self, which will make FESAPI use the current process only. e.g.

auto mpi_hdf = dynamic_cast<EML2_0_NS::HdfProxyMPI>(abstract_hdf_proxy); if (mpi_hdf != nullptr) mpi_hdf->setMPICommunicator(MPI_COMM_SELF);

philippeVerney commented 1 year ago

Thanks for sharing the workaround.

It looks like a bug. We check in the FESAPI code wether the HDF5 library has got parallel support or not : https://github.com/F2I-Consulting/fesapi/blob/79babc0c0ff97ce51496f260a5cf133990957398/src/common/DataObjectRepository.cpp#L29C8-L29C24 If it has parallel support, we assume FESAPI users want to use it. This looks indeed too strict.

I think I will relax it in order to assume FESAPI users want to use HDF5 paralell only when they set HDF_PREFER_PARALLEL to true.