mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Merge pull request #1326 from paulromano/openmpi-fixes
Get test suite to work with OpenMPI
This commit is contained in:
commit
bafdbf8e8b
6 changed files with 27 additions and 9 deletions
|
|
@ -1,6 +1,17 @@
|
|||
import openmc
|
||||
import pytest
|
||||
|
||||
from tests.regression_tests import config
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def mpi_intracomm():
|
||||
if config['mpi']:
|
||||
from mpi4py import MPI
|
||||
return MPI.COMM_WORLD
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def uo2():
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ def pincell_model():
|
|||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def capi_init(pincell_model):
|
||||
openmc.capi.init()
|
||||
def capi_init(pincell_model, mpi_intracomm):
|
||||
openmc.capi.init(intracomm=mpi_intracomm)
|
||||
yield
|
||||
openmc.capi.finalize()
|
||||
|
||||
|
|
@ -408,11 +408,11 @@ def test_mesh(capi_init):
|
|||
assert msf.mesh == mesh
|
||||
|
||||
|
||||
def test_restart(capi_init):
|
||||
def test_restart(capi_init, mpi_intracomm):
|
||||
# Finalize and re-init to make internal state consistent with XML.
|
||||
openmc.capi.hard_reset()
|
||||
openmc.capi.finalize()
|
||||
openmc.capi.init()
|
||||
openmc.capi.init(intracomm=mpi_intracomm)
|
||||
openmc.capi.simulation_init()
|
||||
|
||||
# Run for 7 batches then write a statepoint.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import openmc.capi
|
|||
import pytest
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def complex_cell(run_in_tmpdir):
|
||||
def complex_cell(run_in_tmpdir, mpi_intracomm):
|
||||
|
||||
openmc.reset_auto_ids()
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ def complex_cell(run_in_tmpdir):
|
|||
model.export_to_xml()
|
||||
|
||||
openmc.capi.finalize()
|
||||
openmc.capi.init()
|
||||
openmc.capi.init(intracomm=mpi_intracomm)
|
||||
|
||||
yield
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue