From dd283875a8f8a6bd28ac376cb31ab7f662a39c73 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Tue, 7 Apr 2020 13:49:10 -0500 Subject: [PATCH] Remove restart_timers and have openmc_init/run start/stop total timer --- include/openmc/capi.h | 1 - include/openmc/timer.h | 2 -- openmc/lib/core.py | 5 +---- src/finalize.cpp | 6 ------ src/initialize.cpp | 1 + src/simulation.cpp | 10 ++++++---- src/timer.cpp | 5 ----- 7 files changed, 8 insertions(+), 22 deletions(-) diff --git a/include/openmc/capi.h b/include/openmc/capi.h index a2bab1e2c..11c90ff3a 100644 --- a/include/openmc/capi.h +++ b/include/openmc/capi.h @@ -87,7 +87,6 @@ extern "C" { int openmc_property_map(const void* slice, double* data_out); int openmc_reset(); int openmc_reset_timers(); - int openmc_restart_timers(); int openmc_run(); void openmc_set_seed(int64_t new_seed); int openmc_simulation_finalize(); diff --git a/include/openmc/timer.h b/include/openmc/timer.h index 0ebbe0e8d..cc20751a8 100644 --- a/include/openmc/timer.h +++ b/include/openmc/timer.h @@ -69,8 +69,6 @@ private: void reset_timers(); -void restart_timers(); - } // namespace openmc #endif // OPENMC_TIMER_H diff --git a/openmc/lib/core.py b/openmc/lib/core.py index 8540f832b..b9deed6b1 100644 --- a/openmc/lib/core.py +++ b/openmc/lib/core.py @@ -65,8 +65,6 @@ _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 -_dll.openmc_restart_timers.restype = c_int -_dll.openmc_restart_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 @@ -312,9 +310,8 @@ def reset(): def reset_timers(): - """Reset timers and restart for next batch.""" + """Reset timers.""" _dll.openmc_reset_timers() - _dll.openmc_restart_timers() def run(): diff --git a/src/finalize.cpp b/src/finalize.cpp index 7d80b9fdf..b5d5eb038 100644 --- a/src/finalize.cpp +++ b/src/finalize.cpp @@ -171,12 +171,6 @@ int openmc_reset_timers() return 0; } -int openmc_restart_timers() -{ - restart_timers(); - return 0; -} - int openmc_hard_reset() { // Reset all tallies and timers diff --git a/src/initialize.cpp b/src/initialize.cpp index 10d86ee80..3c2cc03ac 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -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; } diff --git a/src/simulation.cpp b/src/simulation.cpp index 64a7d0e80..0a234e53f 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -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); diff --git a/src/timer.cpp b/src/timer.cpp index 454f77003..fdb10f0f2 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -87,9 +87,4 @@ void reset_timers() simulation::time_event_death.reset(); } -void restart_timers() -{ - simulation::time_total.start(); -} - } // namespace openmc