Merge pull request #1539 from rockfool/timer_reset

Reset timer in depletion for transport performance
This commit is contained in:
Paul Romano 2020-04-08 16:38:54 -05:00 committed by GitHub
commit 0eae88f871
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 5 deletions

View file

@ -86,6 +86,7 @@ extern "C" {
int openmc_id_map(const void* slice, int32_t* data_out);
int openmc_property_map(const void* slice, double* data_out);
int openmc_reset();
int openmc_reset_timers();
int openmc_run();
void openmc_set_seed(int64_t new_seed);
int openmc_simulation_finalize();

View file

@ -289,6 +289,7 @@ class Operator(TransportOperator):
# Run OpenMC
openmc.lib.reset()
openmc.lib.run()
openmc.lib.reset_timers()
# Extract results
op_result = self._unpack_tallies_and_normalize(power)

View file

@ -60,6 +60,8 @@ _dll.openmc_run.restype = c_int
_dll.openmc_run.errcheck = _error_handler
_dll.openmc_reset.restype = c_int
_dll.openmc_reset.errcheck = _error_handler
_dll.openmc_reset_timers.restype = c_int
_dll.openmc_reset_timers.errcheck = _error_handler
_run_linsolver_argtypes = [_array_1d_dble, _array_1d_dble, _array_1d_dble,
c_double]
_dll.openmc_run_linsolver.argtypes = _run_linsolver_argtypes
@ -299,10 +301,15 @@ def plot_geometry():
def reset():
"""Reset tallies and timers."""
"""Reset tally results"""
_dll.openmc_reset()
def reset_timers():
"""Reset timers."""
_dll.openmc_reset_timers()
def run():
"""Run simulation"""
_dll.openmc_run()

View file

@ -165,6 +165,12 @@ int openmc_reset()
return 0;
}
int openmc_reset_timers()
{
reset_timers();
return 0;
}
int openmc_hard_reset()
{
// Reset all tallies and timers

View file

@ -78,6 +78,7 @@ int openmc_init(int argc, char* argv[], const void* intracomm)
// Stop initialization timer
simulation::time_initialize.stop();
simulation::time_total.stop();
return 0;
}

View file

@ -47,6 +47,7 @@
int openmc_run()
{
openmc::simulation::time_total.start();
openmc_simulation_init();
int err = 0;
@ -56,6 +57,7 @@ int openmc_run()
}
openmc_simulation_finalize();
openmc::simulation::time_total.stop();
return err;
}
@ -422,8 +424,8 @@ void finalize_generation()
}
global_tally_leakage = 0.0;
if (settings::run_mode == RunMode::EIGENVALUE) {
// If using shared memory, stable sort the fission bank (by parent IDs)
if (settings::run_mode == RunMode::EIGENVALUE) {
// If using shared memory, stable sort the fission bank (by parent IDs)
// so as to allow for reproducibility regardless of which order particles
// are run in.
sort_fission_bank();
@ -525,7 +527,7 @@ void initialize_history_partial(Particle* p)
p->flux_derivs_.resize(model::tally_derivs.size(), 0.0);
std::fill(p->flux_derivs_.begin(), p->flux_derivs_.end(), 0.0);
}
// Allocate space for tally filter matches
p->filter_matches_.resize(model::tally_filters.size());
}
@ -669,7 +671,7 @@ void transport_event_based()
process_collision_events();
}
}
// Execute death event for all particles
process_death_events(n_particles);