Parallel HDF5 not detected with HDF5 2.x and CMake older than 4.3

オープン 初心者向け
#4,213 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cmake
領域
build-system

調査の方向性

修正箇所は、既存の find_package(HDF5 ...) の近くにある CMakeLists.txt です。HDF5_PROVIDES_PARALLEL と古いシグナルである HDF5_IS_PARALLEL を比較し、それに応じて並列フラグを設定してください。まず CMake 3.26.5 または 4.2.3 と並列 HDF5 2.2.0 で再現し、次に build/CMakeFiles/libopenmc_objects.dir/flags.make に -DPHDF5 があることと、構成出力に Using parallel HDF5 があることを確認してください。3 ランクでのペイロードの MPI 書き込み/読み取りチェックが完了基準です。また、MPI を使用しない並列 HDF5 に対する構成エラーが意図したものかどうかも判断してください。

索引モデルが issue の本文から書いたものです。

説明

Bug Description

With HDF5 2.x and CMake older than 4.3, OpenMC does not detect a parallel HDF5 installation. Configuration succeeds with no warning, but -- Using parallel HDF5 is not printed and PHDF5 is not defined, so OpenMC writes through the master rank instead of using collective I/O.

FindHDF5.cmake in older CMake sets HDF5_IS_PARALLEL from HDF5_ENABLE_PARALLEL. HDF5 2.x config packages set HDF5_PROVIDES_PARALLEL instead. CMake fixed this in 4.3 (Kitware/CMake@27e558dfa5), but OpenMC allows CMake 3.22 and later, so older versions still hit it.

Results from configuring develop (e43e165) against a parallel HDF5 2.2.0 (h5pcc -showconfig reports Parallel HDF5: ON):

CMake CMakeLists.txt Using parallel HDF5 -DPHDF5
3.26.5 unchanged no no
4.2.3 unchanged no no
4.3.2 unchanged yes yes
3.26.5 fallback below yes yes

Possible fallback, placed after find_package(HDF5 ...):

if(HDF5_PROVIDES_PARALLEL)
  set(HDF5_IS_PARALLEL TRUE)
endif()

Passing -DHDF5_ENABLE_PARALLEL=ON also works around it on 3.26.5.

I also tested the fallback on the same commit with CMake 3.26.5. Where the table says "3 ranks ok", I did a full build and a small MPI program wrote a source bank with write_h5_source_point and read all 300 sites back on each of 3 ranks.

HDF5 OPENMC_USE_MPI Unchanged With fallback
2.2.0 parallel ON not detected detected, 3 ranks ok
2.2.0 serial ON not detected not detected, 3 ranks ok
2.2.0 serial OFF not run not detected, configure only
1.14.6 parallel ON detected detected, 3 ranks ok
1.14.6 parallel OFF "MPI was not enabled" error same error
2.2.0 parallel OFF not detected, builds "MPI was not enabled" error

The last row is a behavior change: parallel HDF5 2.x without MPI builds today and would stop at configure with the fallback. That matches how HDF5 1.14 already behaves, but it could affect anyone relying on that combination.

I have not run the OpenMC test suite with any of these, or tested with MPICH.

This came up through Cardinal, where code that assumed collective I/O started failing on a file lock (neams-th-coe/cardinal#1499). A fix for that is open on the Cardinal side, and OpenMC's own writes still work without PHDF5. The problem here is that parallel I/O is silently turned off.

Steps to Reproduce

In idaholab/moose-dev:2026.10.19, which has CMake 3.26.5 and a parallel HDF5 2.2.0 in /opt/petsc:

export HDF5_ROOT=/opt/petsc
git clone --depth 1 https://github.com/openmc-dev/openmc.git
cmake -S openmc -B build -DCMAKE_BUILD_TYPE=Release -DOPENMC_USE_MPI=ON \
  -DOPENMC_BUILD_TESTS=off -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx
grep -c -- '-DPHDF5' build/CMakeFiles/libopenmc_objects.dir/flags.make

The output has Found HDF5: hdf5-shared (found version "2.2.0") but no Using parallel HDF5, and the grep prints 0.

Environment

  • OS: Rocky Linux container idaholab/moose-dev:2026.10.19, run under Docker on Windows
  • OpenMC: develop at e43e165, built from source
  • HDF5: 2.2.0 parallel built by PETSc; 2.2.0 serial and 1.14.6 parallel built from source with CMake
  • MPI: OpenMPI (mpicc/mpicxx)
  • CMake: 3.26.5 from the container, plus official 4.2.3 and 4.3.2 binaries
  • Nuclear data: not used
主要言語
Python
スター
1.1k
フォーク
683
平均マージ
3日 10時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openmc-dev/openmc のほかの issue

openmc-dev/openmc の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。