mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
parent
e3f50f2269
commit
8b2c515ea6
5 changed files with 20 additions and 10 deletions
|
|
@ -253,14 +253,15 @@ foreach(test ${TESTS})
|
|||
# Preform a parallel test
|
||||
add_test(NAME ${TEST_NAME}
|
||||
WORKING_DIRECTORY ${TEST_PATH}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${TEST_NAME} --mpi_exec)
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${TEST_NAME} --exe $<TARGET_FILE:openmc>
|
||||
--mpi_exec)
|
||||
|
||||
else(${MPI_ENABLED})
|
||||
|
||||
# Perform a serial test
|
||||
add_test(NAME ${TEST_NAME}
|
||||
WORKING_DIRECTORY ${TEST_PATH}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${TEST_NAME})
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${TEST_NAME} --exe $<TARGET_FILE:openmc>)
|
||||
|
||||
endif(${MPI_ENABLED})
|
||||
|
||||
|
|
|
|||
|
|
@ -56,14 +56,15 @@ class Executor(object):
|
|||
|
||||
self._working_directory = working_directory
|
||||
|
||||
def plot_geometry(self, output=True):
|
||||
def plot_geometry(self, output=True, openmc_exec='openmc'):
|
||||
"""Run OpenMC in plotting mode"""
|
||||
|
||||
return self._run_openmc('openmc -p', output)
|
||||
return self._run_openmc(openmc_exec + ' -p', output)
|
||||
|
||||
def run_simulation(self, particles=None, threads=None,
|
||||
geometry_debug=False, restart_file=None,
|
||||
tracks=False, mpi_procs=1, output=True):
|
||||
tracks=False, mpi_procs=1, output=True,
|
||||
openmc_exec='openmc'):
|
||||
"""Run an OpenMC simulation.
|
||||
|
||||
Parameters
|
||||
|
|
@ -82,6 +83,8 @@ class Executor(object):
|
|||
Number of MPI processes
|
||||
output : bool
|
||||
Capture OpenMC output from standard out
|
||||
openmc_exec : str
|
||||
Path to OpenMC executable
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -106,6 +109,6 @@ class Executor(object):
|
|||
if isinstance(mpi_procs, Integral) and mpi_procs > 1:
|
||||
pre_args += 'mpirun -n {0} '.format(mpi_procs)
|
||||
|
||||
command = pre_args + 'openmc ' + post_args
|
||||
command = pre_args + openmc_exec + ' ' + post_args
|
||||
|
||||
return self._run_openmc(command, output)
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@ class SourceFileTestHarness(TestHarness):
|
|||
|
||||
# Run OpenMC.
|
||||
executor = Executor()
|
||||
returncode = executor.run_simulation(mpi_procs=mpi_procs)
|
||||
returncode = executor.run_simulation(mpi_procs=mpi_procs,
|
||||
openmc_exec=self._opts.exe)
|
||||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
|
||||
def _cleanup(self):
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ class StatepointRestartTestHarness(TestHarness):
|
|||
# Run OpenMC
|
||||
executor = Executor()
|
||||
returncode = executor.run_simulation(mpi_procs=mpi_procs,
|
||||
restart_file=statepoint)
|
||||
restart_file=statepoint,
|
||||
openmc_exec = self._opts.exe)
|
||||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ class TestHarness(object):
|
|||
|
||||
def _parse_args(self):
|
||||
parser = OptionParser()
|
||||
parser.add_option('--exe', dest='exe', default='openmc')
|
||||
parser.add_option('--mpi_exec', dest='mpi_exec', action='store_true',
|
||||
default=False)
|
||||
parser.add_option('--mpi_np', dest='mpi_np', type=int, default=3)
|
||||
|
|
@ -65,13 +66,16 @@ class TestHarness(object):
|
|||
(self._opts, self._args) = parser.parse_args()
|
||||
|
||||
def _run_openmc(self):
|
||||
print('******')
|
||||
print(self._opts.exe)
|
||||
if self._opts.mpi_exec:
|
||||
mpi_procs = self._opts.mpi_np
|
||||
else:
|
||||
mpi_procs = 1
|
||||
|
||||
executor = Executor()
|
||||
returncode = executor.run_simulation(mpi_procs=mpi_procs)
|
||||
returncode = executor.run_simulation(mpi_procs=mpi_procs,
|
||||
openmc_exec=self._opts.exe)
|
||||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
|
||||
def _test_output_created(self):
|
||||
|
|
@ -160,7 +164,7 @@ class PlotTestHarness(TestHarness):
|
|||
|
||||
def _run_openmc(self):
|
||||
executor = Executor()
|
||||
returncode = executor.plot_geometry()
|
||||
returncode = executor.plot_geometry(openmc_exec=self._opts.exe)
|
||||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
|
||||
def _test_output_created(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue