Fixing issues related to linking parallel hdf5 on cmake#391
Open
dutta-alankar wants to merge 4 commits into
Open
Fixing issues related to linking parallel hdf5 on cmake#391dutta-alankar wants to merge 4 commits into
dutta-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.
Contributor
Author
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.