diff --git a/openmc/deplete/__init__.py b/openmc/deplete/__init__.py index e49c4e69cf..721bd636cc 100644 --- a/openmc/deplete/__init__.py +++ b/openmc/deplete/__init__.py @@ -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