Skip to content

Commit d217efa

Browse files
authored
Add two MPI barriers in R2S workflow (#3646)
1 parent f544d02 commit d217efa

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

openmc/deplete/microxs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ def get_microxs_and_flux(
177177
if not openmc.lib.is_initialized:
178178
run_kwargs.setdefault('cwd', temp_dir)
179179

180-
# Run transport simulation
180+
# Run transport simulation and synchronize
181181
statepoint_path = model.run(**run_kwargs)
182+
comm.barrier()
182183

183184
if comm.rank == 0:
184185
# Move the statepoint file if it is being saved to a specific path

openmc/deplete/r2s.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ def step2_activation(
392392
)
393393
output_path = output_dir / 'depletion_results.h5'
394394
integrator.integrate(final_step=False, path=output_path)
395+
comm.barrier()
395396

396397
# Get depletion results
397398
self.results['depletion_results'] = Results(output_path)

openmc/lib/core.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pathlib import Path
88
from random import getrandbits
99
from tempfile import TemporaryDirectory
10+
import traceback as tb
1011

1112
import numpy as np
1213
from numpy.ctypeslib import as_array
@@ -700,6 +701,15 @@ def __exit__(self, exc_type, exc_value, traceback):
700701
if self.already_initialized:
701702
return
702703

704+
# If an exception occurred, abort all ranks immediately
705+
if exc_type is not None:
706+
# Print exception info on the rank that failed
707+
tb.print_exception(exc_type, exc_value, traceback)
708+
sys.stdout.flush()
709+
710+
# Abort all MPI processes
711+
self.comm.Abort(1)
712+
703713
try:
704714
finalize()
705715
finally:

0 commit comments

Comments
 (0)