mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Check that hdf5 has MPI if performing depletion with MPI
Check added in openmc/depletion/__init__.py. Without this check, the exporting of the Results to hdf5 will hang, as the second process attempts to write to a file that has already been opened on another process. This error is only raised after a full transport calculation has been run. The check raises a more helpful error directly at the import from openmc.deplete, prior to transport calculations.
This commit is contained in:
parent
812c667c81
commit
6370b362c7
1 changed files with 14 additions and 0 deletions
|
|
@ -6,10 +6,24 @@ A depletion front-end tool.
|
|||
"""
|
||||
|
||||
from .dummy_comm import DummyCommunicator
|
||||
|
||||
try:
|
||||
from mpi4py import MPI
|
||||
|
||||
comm = MPI.COMM_WORLD
|
||||
have_mpi = True
|
||||
# check if running with MPI and if hdf5 is MPI-enabled
|
||||
from h5py import get_config
|
||||
|
||||
if not get_config().mpi and comm.size > 1:
|
||||
# Raise exception only on process 0
|
||||
if comm.rank:
|
||||
from sys import exit
|
||||
|
||||
exit()
|
||||
raise RuntimeError(
|
||||
"Need MPI-enabled HDF5 install to perform depletion with MPI"
|
||||
)
|
||||
except ImportError:
|
||||
comm = DummyCommunicator()
|
||||
have_mpi = False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue