Clean up imports in openmc/deplete/__init__.py

This commit is contained in:
Andrew Johnson 2019-06-25 13:26:01 -05:00
parent 6370b362c7
commit 830c0237a8
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB

View file

@ -4,6 +4,9 @@ openmc.deplete
A depletion front-end tool.
"""
from sys import exit
from h5py import get_config
from .dummy_comm import DummyCommunicator
@ -12,17 +15,14 @@ try:
comm = MPI.COMM_WORLD
have_mpi = True
# check if running with MPI and if hdf5 is MPI-enabled
from h5py import get_config
# 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:
from sys import exit
exit()
raise RuntimeError(
"Need MPI-enabled HDF5 install to perform depletion with MPI"
"Need parallel HDF5 installed to perform depletion with MPI"
)
except ImportError:
comm = DummyCommunicator()