Add two MPI barriers in R2S workflow (#3646)

This commit is contained in:
Paul Romano 2025-11-20 12:10:04 -06:00 committed by GitHub
parent f544d02e49
commit d217efa007
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 1 deletions

View file

@ -177,8 +177,9 @@ def get_microxs_and_flux(
if not openmc.lib.is_initialized:
run_kwargs.setdefault('cwd', temp_dir)
# Run transport simulation
# Run transport simulation and synchronize
statepoint_path = model.run(**run_kwargs)
comm.barrier()
if comm.rank == 0:
# Move the statepoint file if it is being saved to a specific path

View file

@ -392,6 +392,7 @@ class R2SManager:
)
output_path = output_dir / 'depletion_results.h5'
integrator.integrate(final_step=False, path=output_path)
comm.barrier()
# Get depletion results
self.results['depletion_results'] = Results(output_path)

View file

@ -7,6 +7,7 @@ import os
from pathlib import Path
from random import getrandbits
from tempfile import TemporaryDirectory
import traceback as tb
import numpy as np
from numpy.ctypeslib import as_array
@ -700,6 +701,15 @@ class TemporarySession:
if self.already_initialized:
return
# If an exception occurred, abort all ranks immediately
if exc_type is not None:
# Print exception info on the rank that failed
tb.print_exception(exc_type, exc_value, traceback)
sys.stdout.flush()
# Abort all MPI processes
self.comm.Abort(1)
try:
finalize()
finally: