Merge pull request #1268 from drewejohnson/operator-mpi-checks

Check that hdf5 has MPI if performing depletion with MPI
This commit is contained in:
Paul Romano 2019-06-26 13:53:22 -05:00 committed by GitHub
commit d10265ac2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,12 +4,26 @@ openmc.deplete
A depletion front-end tool.
"""
from sys import exit
from h5py import get_config
from .dummy_comm import DummyCommunicator
try:
from mpi4py import MPI
comm = MPI.COMM_WORLD
have_mpi = True
# check if running with MPI and if using parallel HDF5
if not get_config().mpi and comm.size > 1:
# Raise exception only on process 0
if comm.rank:
exit()
raise RuntimeError(
"Need parallel HDF5 installed to perform depletion with MPI"
)
except ImportError:
comm = DummyCommunicator()
have_mpi = False