Simulation Manager¶
The SimulationManager in NEST is responsible for controlling the simulation workflow, managing time progression, and coordinating computational steps across nodes. It tracks simulation duration, active nodes, and parallel execution details (e.g., MPI processes/OpenMP threads), ensuring synchronization and logging critical progress. It handles time slicing, updates, and ensures consistent state transitions between preparation, execution, and cleanup phases.
-
class SimulationManager : public nest::ManagerInterface¶
Public Functions
-
virtual void initialize(const bool) override¶
Prepare manager for operation.
After this method has completed, the manager should be completely initialized and “ready for action”.
See also
Note
Initialization of any given manager may depend on other managers having been initialized before. KernelManager::initialize() is responsible for calling the initialization routines on the specific managers in correct order.
- Parameters:
adjust_number_of_threads_or_rng_only – Pass true if calling from kernel_manager::change_number_of_threads() or RandomManager::get_status() to limit operations to those necessary for thread adjustment or switch or re-seeding of RNG.
-
virtual void finalize(const bool) override¶
Take down manager after operation.
After this method has completed, all dynamic data structures created by the manager shall be deallocated and containers emptied. Plain variables need not be reset.
See also
Note
Finalization of any given manager may depend on other managers not having been finalized yet. KernelManager::finalize() is responsible for calling the initialization routines on the specific managers in correct order, i.e., the opposite order of initialize() calls.
- Parameters:
adjust_number_of_threads_or_rng_only – Pass true if calling from kernel_manager::change_number_of_threads() to limit operations to those necessary for thread adjustment.
-
virtual void set_status(const DictionaryDatum&) override¶
Set the status of the manager.
See also
-
virtual void get_status(DictionaryDatum&) override¶
Retrieve the status of the manager.
See also
Note
This would ideally be a const function. However, some managers delay the update of internal variables up to the point where they are needed (e.g., before reporting their values to the user, or before simulate is called). An example for this pattern is the call to update_delay_extrema_() right at the beginning of ConnectionManager::get_status().
-
void assert_valid_simtime(Time const&)¶
Check for errors in time before run.
- Throws:
KernelException – if illegal time passed
-
virtual void prepare() override¶
Initialize simulation for a set of run calls.
Must be called before a sequence of runs, and again after cleanup.
-
void run(Time const&)¶
Run a simulation for another
Time.Can be repeated ad infinitum with calls to get_status(), but any changes to the network are undefined, leading serious risk of incorrect results.
-
virtual void cleanup() override¶
Closes a set of runs, doing finalizations such as file closures.
After cleanup() is called, no more run()s can be called before another prepare() call.
-
inline bool use_wfr() const¶
Returns true if waveform relaxation is used.
-
inline double get_wfr_comm_interval() const¶
Get the desired communication interval for the waveform relaxation.
-
inline double get_wfr_tol() const¶
Get the convergence tolerance of the waveform relaxation method.
-
inline size_t get_wfr_interpolation_order() const¶
Get the interpolation order of the waveform relaxation method.
-
inline Time const &get_slice_origin() const¶
Get the time at the beginning of the current time slice.
-
Time const get_previous_slice_origin() const¶
Get the time at the beginning of the previous time slice.
-
inline Time const get_time() const¶
Precise time of simulation.
Note
The precise time of the simulation is defined only while the simulation is not in progress.
-
inline bool has_been_simulated() const¶
Return true, if the SimulationManager has already been simulated for some time.
This does NOT indicate that simulate has been called (i.e. if Simulate is called with 0 as argument, the flag is still set to false.)
-
inline bool has_been_prepared() const¶
Return true, if the SimulationManager has been prepared for simulation.
This is the case from the time when the Prepare function is called until the simulation context is left by a call to Cleanup.
-
inline size_t get_slice() const¶
Get slice number.
Increased by one for each slice. Can be used to choose alternating buffers.
-
inline Time const &get_clock() const¶
Return current simulation time.
-
inline Time run_end_time() const¶
Get the simulation’s time at the end of the current call to run().
-
inline long get_from_step() const¶
Return start of current time slice, in steps.
-
inline long get_to_step() const¶
Return end of current time slice, in steps.
-
void update_connection_infrastructure(const size_t tid)¶
Sorts source table and connections and create new target table.
-
virtual void reset_timers_for_preparation()¶
Set time measurements for internal profiling to zero (reg.
prep.)
-
virtual void reset_timers_for_dynamics()¶
Set time measurements for internal profiling to zero (reg.
sim. dyn.)
-
virtual void initialize(const bool) override¶