Fixing issues related to linking parallel hdf5 on cmake - #391
Fixing issues related to linking parallel hdf5 on cmake#391dutta-alankar wants to merge 4 commits into
Conversation
find_package(HDF5) can resolve through the HDF5-provided CMake config package (config mode), which does not set HDF5_IS_PARALLEL. The previous 'if(NOT HDF5_IS_PARALLEL)' check then wrongly failed for a genuinely parallel HDF5 build. Detect parallel support robustly: prefer imported targets (hdf5::hdf5 / HDF5::HDF5), fall back to the FindHDF5 module, and determine parallelism from HDF5_IS_PARALLEL/HDF5_C_IS_PARALLEL, 'h5cc -showconfig', or an H5Pset_fapl_mpio compile+link probe.
Mark variables that are unused in some build configurations as [[maybe_unused]]: the MPI buffer index locals in Axis::ExchangeMPI and tot_dim in the DIMENSIONS==2 branch of Xdmf::Write.
There was a problem hiding this comment.
Pull request overview
This PR adjusts Idefix’s CMake HDF5 discovery/linking to better support parallel HDF5 builds (especially when HDF5 is found via a CMake config package), and it also suppresses a couple of unused-variable warnings in C++ sources.
Changes:
- Update
CMakeLists.txtto prefer HDF5 imported targets when available and add a robust parallel-HDF5 detection probe for MPI builds. - Suppress unused-variable warnings in
src/output/xdmf.cppandsrc/fluid/boundary/axis.cppusing[[maybe_unused]].
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| CMakeLists.txt | Improves HDF5 linking target selection and adds a more reliable parallel-HDF5 detection mechanism when Idefix_MPI=ON. |
| src/output/xdmf.cpp | Adds [[maybe_unused]] for tot_dim in the DIMENSIONS==2 branch to silence warnings. |
| src/fluid/boundary/axis.cpp | Marks local variables as [[maybe_unused]] in Axis::ExchangeMPI to suppress unused-variable warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This is first of few PRs (as discussed in #349) that I am going to put in the next few weeks, final being the introduction of the Tabulated radiative cooling module once all these other changes get merged. |
Minor Co-pilot suggested fixes Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@svalat I plan to put in the Cooling module on top of these commits. So, it would be nice if you could review this and this PR gets merged. |
On our Freya cluster at MPCDF, I tried compiling Idefix using the following after setting
IDEFIX_DIR:This resulted in an error in linking hdf5 library. Following is the error message:
This comes up despite having parallel support enabled hdf5 library. This PR addresses the issue and introduces a robust hdf5 linking section in
CMakeLists.txt.Apart from this, there are two minor edits to suppress unused variable warnings.