added command line argument for event-based mode.

This commit is contained in:
John Tramm 2020-01-24 02:31:00 +00:00
parent 1a806cd654
commit e0da6af91e
4 changed files with 10 additions and 2 deletions

View file

@ -6,7 +6,6 @@
<batches>100</batches>
<inactive>10</inactive>
<particles>1000</particles>
<event_based>true</event_based>
<!-- The starting source is a uniform distribution over the entire pin
cell. Note that since this is effectively a 2D model, the z coordinates

View file

@ -154,7 +154,7 @@ def calculate_volumes(threads=None, output=True, cwd='.',
def run(particles=None, threads=None, geometry_debug=False,
restart_file=None, tracks=False, output=True, cwd='.',
openmc_exec='openmc', mpi_args=None):
openmc_exec='openmc', mpi_args=None, event_based=False):
"""Run an OpenMC simulation.
Parameters
@ -182,6 +182,8 @@ def run(particles=None, threads=None, geometry_debug=False,
mpi_args : list of str, optional
MPI execute command and any additional MPI arguments to pass,
e.g. ['mpiexec', '-n', '8'].
event_based : bool, optional
Turns on event-based parallelism, instead of default history-based
Raises
------
@ -199,6 +201,9 @@ def run(particles=None, threads=None, geometry_debug=False,
if geometry_debug:
args.append('-g')
if event_based:
args.append('-e')
if isinstance(restart_file, str):
args += ['-r', restart_file]

View file

@ -134,6 +134,9 @@ parse_command_line(int argc, char* argv[])
} else if (arg == "-n" || arg == "--particles") {
i += 1;
settings::n_particles = std::stoll(argv[i]);
} else if (arg == "-e" || arg == "--event") {
settings::event_based = true;
} else if (arg == "-r" || arg == "--restart") {
i += 1;

View file

@ -327,6 +327,7 @@ void print_usage()
" or a particle restart file\n"
" -s, --threads Number of OpenMP threads\n"
" -t, --track Write tracks for all particles\n"
" -e, --event Run using event-based parallelism\n"
" -v, --version Show version information\n"
" -h, --help Show this message\n";
}