Uh oh!
There was an error while loading. Please reload this page.
Fixing issues related to linking parallel hdf5 on cmake - #391
Fixing issues related to linking parallel hdf5 on cmake#391dutta-alankar wants to merge 6 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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
dutta-alankar
commented
Jul 15, 2026
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>
dutta-alankar
commented
Jul 27, 2026
@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. |
svalat
left a comment
There was a problem hiding this comment.
A minor change request and it looks ok to me, thanks for the proposal.
Uh oh!
There was an error while loading. Please reload this page.
@svalat Let me know if you're happy with the changes introduced. |
svalat
commented
Aug 18, 2026
Hi, the patch is OK to me, thanks for it. |
@svalat I do not seem to find the option to accept your change. |
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.