diff --git a/openmc/deplete/__init__.py b/openmc/deplete/__init__.py index 32588588ef..08338c3f74 100644 --- a/openmc/deplete/__init__.py +++ b/openmc/deplete/__init__.py @@ -5,16 +5,17 @@ openmc.deplete A depletion front-end tool. """ +from unittest import Mock + from .dummy_comm import DummyCommunicator try: from mpi4py import MPI comm = MPI.COMM_WORLD have_mpi = True - mpi_sum = MPI.SUM except ImportError: comm = DummyCommunicator() have_mpi = False - mpi_sum = lambda x: x + MPI = Mock() from .nuclide import * from .chain import * diff --git a/openmc/deplete/results.py b/openmc/deplete/results.py index 8c47706b75..bdee89b6ca 100644 --- a/openmc/deplete/results.py +++ b/openmc/deplete/results.py @@ -10,7 +10,7 @@ from warnings import warn import numpy as np import h5py -from . import comm, have_mpi, mpi_sum +from . import comm, have_mpi, MPI from .reaction_rates import ReactionRates _VERSION_RESULTS = (1, 0) @@ -452,7 +452,7 @@ class Results(object): results.power = power results.proc_time = proc_time if results.proc_time is not None: - results.proc_time = comm.reduce(proc_time, op=mpi_sum) + results.proc_time = comm.reduce(proc_time, op=MPI.SUM) results.export_to_hdf5("depletion_results.h5", step_ind)