NEST  2.6.0,not_revisioned_source_dir@0
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
nest::Scheduler Class Reference

Schedule update of Nodes and Events during simulation. More...

#include <scheduler.h>

Public Member Functions

 Scheduler (Network &)
 
virtual ~Scheduler ()
 
void reset ()
 Bring scheduler back to its initial state. More...
 
void clear_pending_spikes ()
 Clear all pending spikes, but do not otherwise manipulate scheduler. More...
 
void simulate (Time const &)
 Simulate for the given time . More...
 
void resume ()
 Resume simulation after an interrupt. More...
 
void prepare_simulation ()
 All steps that must be done before a simulation. More...
 
void finalize_simulation ()
 Cleanup after the simulation. More...
 
void terminate ()
 
void send_remote (thread p, SpikeEvent &, const long_t lag=0)
 Add global id of event sender to the spike_register. More...
 
void send_offgrid_remote (thread p, SpikeEvent &, const long_t lag=0)
 Add global id of event sender to the spike_register. More...
 
Nodethread_lid_to_node (thread t, targetindex thread_local_id) const
 
thread get_num_threads () const
 Return the number of threads used during simulation. More...
 
void set_num_threads (thread n_threads)
 Set the number of threads by setting the internal variable n_threads_, the corresponding value in the Communicator, and the OpenMP number of threads. More...
 
thread get_num_processes () const
 Return the number of processes used during simulation. More...
 
thread get_num_rec_processes () const
 
thread get_num_sim_processes () const
 
void set_num_rec_processes (int nrp, bool called_by_reset=false)
 Set number of recording processes, switches NEST to global spike detection mode. More...
 
void increment_n_gsd ()
 Increment total number of global spike detectors by 1. More...
 
index get_n_gsd ()
 Get total number of global spike detectors. More...
 
bool is_local_node (Node *) const
 Return true if the node on the local machine, false if not. More...
 
bool is_local_vp (thread) const
 Return true if the thread is on the local machine, false if not. More...
 
thread suggest_vp (index gid) const
 Return a thread number for a given global node id. More...
 
thread suggest_rec_vp (index gid) const
 Return a thread number for a given global recording node id. More...
 
thread vp_to_thread (thread vp) const
 
thread thread_to_vp (thread t) const
 
thread get_global_thread_id (thread lt) const
 Return the global thread id of a local thread. More...
 
thread get_process_id (thread vp) const
 Return the process id for a given virtual process. More...
 
bool get_simulated () const
 Return true, if the network has already been simulated for some time. More...
 
void set_off_grid_communication (bool off_grid_spiking)
 set communication style to off_grid (true) or on_grid More...
 
bool get_off_grid_communication () const
 return current communication style. More...
 
Time const & get_slice_origin () const
 Time at beginning of current slice. More...
 
Time get_previous_slice_origin () const
 Time at beginning of previous slice. More...
 
Time const get_time () const
 Precise time of simulation. More...
 
void update ()
 Update all non-frozen nodes. More...
 
void set_network_ (Network *)
 
void set_status (const DictionaryDatum &)
 
void get_status (DictionaryDatum &) const
 
librandom::RngPtr get_rng (const thread) const
 Return pointer to random number generator of the specified thread. More...
 
librandom::RngPtr get_grng () const
 Return pointer to global random number generator. More...
 
size_t get_slice () const
 Get slice number. More...
 
void calibrate_clock ()
 Calibrate clock after resolution change. More...
 
void ensure_valid_thread_local_ids ()
 Ensure that all nodes in the network have valid thread-local IDs. More...
 

Static Public Member Functions

static delay get_modulo (delay d)
 Return (T+d) mod max_delay. More...
 
static delay get_slice_modulo (delay d)
 Index to slice-based buffer. More...
 
static delay get_min_delay ()
 Return minimal connection delay. More...
 
static delay get_max_delay ()
 Return maximal connection delay. More...
 

Private Member Functions

void init_ ()
 Initialize the scheduler by initializing the buffers. More...
 
void finalize_ ()
 Finalize the scheduler by freeing the buffers and destoying the mutexes. More...
 
void advance_time_ ()
 
void print_progress_ ()
 
void prepare_nodes ()
 Prepare nodes for simulation and register nodes in node_list. More...
 
void prepare_node_ (Node *)
 Initialized buffers, register in list of nodes to update/finalize. More...
 
void finalize_nodes ()
 Invoke finalize() on nodes registered for finalization. More...
 
void compute_moduli_ ()
 Re-compute table of fixed modulos, including slice-based. More...
 
void init_moduli_ ()
 
void create_rngs_ (const bool ctor_call=false)
 
void create_grng_ (const bool ctor_call=false)
 
void configure_spike_buffers_ ()
 Resize spike_register and comm_buffer to correct dimensions. More...
 
void update_nodes_vec_ ()
 Create up-to-date vector of local nodes, nodes_vec_. More...
 
void collocate_buffers_ ()
 Rearrange the spike_register into a 2-dim structure. More...
 
void gather_events_ ()
 Collocate buffers and exchange events with other MPI processes. More...
 
void deliver_events_ (thread t)
 Read all event buffers for thread t and send the corresponding Events to the Nodes that are targeted. More...
 

Static Private Member Functions

static void update_delay_extrema_ ()
 Update delay extrema to current values. More...
 

Private Attributes

bool initialized_
 
bool simulating_
 true if simulation in progress More...
 
bool force_singlethreading_
 
index n_threads_
 Number of threads per process. More...
 
index n_rec_procs_
 MPI processes dedicated for recording devices. More...
 
index n_sim_procs_
 MPI processes used for simulation. More...
 
index n_gsd_
 Total number of global spike detectors, used for distributing them over recording processes. More...
 
volatile index entry_counter_
 Counter for entry barrier. More...
 
volatile index exit_counter_
 Counter for exit barrier. More...
 
vector< vector< Node * > > nodes_vec_
 Nodelists for nodes for each thread. More...
 
index nodes_vec_network_size_
 Network size when nodes_vec_ was last updated. More...
 
Time clock_
 Network clock, updated once per slice. More...
 
delay slice_
 current update slice More...
 
delay to_do_
 number of pending cycles. More...
 
delay to_do_total_
 number of requested cycles in current simulation. More...
 
delay from_step_
 update clock_+from_step<=T<clock_+to_step_ More...
 
delay to_step_
 update clock_+from_step<=T<clock_+to_step_ More...
 
timeval t_slice_begin_
 Wall-clock time at the begin of a time slice. More...
 
timeval t_slice_end_
 Wall-clock time at the end of time slice. More...
 
long t_real_
 Accumunated wall-clock time spent simulating (in us) More...
 
bool terminate_
 Terminate on signal or error. More...
 
bool simulated_
 indicates whether the network has already been simulated for some time More...
 
bool off_grid_spiking_
 indicates whether spikes are not constrained to the grid More...
 
bool print_time_
 Indicates whether time should be printed during simulations (or not) More...
 
std::vector< long_trng_seeds_
 The seeds of the local RNGs. These do not neccessarily describe the state of the RNGs. More...
 
long_t grng_seed_
 The seed of the global RNG, not neccessarily describing the state of the GRNG. More...
 
vector< librandom::RngPtrrng_
 Vector of random number generators for threads. More...
 
librandom::RngPtr grng_
 Global random number generator. More...
 
std::vector< std::vector
< std::vector< uint_t > > > 
spike_register_
 Register for gids of neurons that spiked. More...
 
std::vector< std::vector
< std::vector< OffGridSpike > > > 
offgrid_spike_register_
 Register for off-grid spikes. More...
 
std::vector< uint_tlocal_grid_spikes_
 Buffer containing the gids of local neurons that spiked in the last min_delay_ interval. More...
 
std::vector< uint_tglobal_grid_spikes_
 Buffer containing the gids of all neurons that spiked in the last min_delay_ interval. More...
 
std::vector< OffGridSpikelocal_offgrid_spikes_
 Buffer containing the gids and offsets for local neurons that fired off-grid spikes in the last min_delay_ interval. More...
 
std::vector< OffGridSpikeglobal_offgrid_spikes_
 Buffer containing the gids and offsets for all neurons that fired off-grid spikes in the last min_delay_ interval. More...
 
std::vector< int > displacements_
 Buffer containing the starting positions for the spikes from each process within the global_(off)grid_spikes_ buffer. More...
 

Static Private Attributes

static Networknet_ = 0
 Pointer to network object. More...
 
static delay min_delay_ = 1
 Value of the smallest delay in the network. More...
 
static delay max_delay_ = 1
 Value of the largest delay in the network. More...
 
static vector< delaymoduli_
 Table of pre-computed modulos. More...
 
static vector< delayslice_moduli_
 Table of pre-computed slice-based modulos. More...
 
static const delay comm_marker_ = 0
 Marker Value to be put between the data fields from different time steps during communication. More...
 

Detailed Description

Schedule update of Nodes and Events during simulation.

The scheduler controls a number of threads which are responsible for updating a batch of Nodes independently from each other. The number of threads as well as the batch size of each thread can be configured with get_status and set_status methods.

The scheduler also controls the random number clients which are associated to the threads.

The scheduler is usually hidden inside the network class. Thus, its interface is of little interest to the "normal" model developer.

Constructor & Destructor Documentation

nest::Scheduler::Scheduler ( Network net)

References init_(), and net_.

nest::Scheduler::~Scheduler ( )
virtual

Member Function Documentation

void nest::Scheduler::advance_time_ ( )
private

Referenced by prepare_nodes().

void nest::Scheduler::calibrate_clock ( )
inline

Calibrate clock after resolution change.

References nest::Time::calibrate(), and clock_.

Referenced by nest::Network::calibrate_clock().

void nest::Scheduler::clear_pending_spikes ( )

Clear all pending spikes, but do not otherwise manipulate scheduler.

Note
This is used by Network::reset_network().

Referenced by nest::Network::reset_network().

void nest::Scheduler::collocate_buffers_ ( )
private

Rearrange the spike_register into a 2-dim structure.

This is done by collecting the spikes from all threads in each slice of the min_delay_ interval.

Referenced by prepare_nodes().

void nest::Scheduler::compute_moduli_ ( )
private

Re-compute table of fixed modulos, including slice-based.

This function is called after all nodes have been updated.

We can compute the value of (T+d) mod max_delay without explicit reference to the network clock, because compute_moduli_ is called whenever the network clock advances. The various modulos for all available delays are stored in a lookup-table and this table is rotated once per time slice.

References assert(), and nest::names::d.

void nest::Scheduler::configure_spike_buffers_ ( )
private

Resize spike_register and comm_buffer to correct dimensions.

Resizes also offgrid_*_buffer_. This is done by resume() when called for the first time. The spike buffers cannot be reconfigured later, whence neither the number of local threads or the min_delay can change after simulate() has been called. ConnectorModel::check_delay() and Scheduler::set_status() ensure this.

References assert(), nest::names::clear, nest::Communicator::get_num_processes(), and nest::Communicator::set_buffer_sizes().

void nest::Scheduler::create_grng_ ( const bool  ctor_call = false)
private

Referenced by prepare_nodes().

void nest::Scheduler::create_rngs_ ( const bool  ctor_call = false)
private

Referenced by prepare_nodes().

void nest::Scheduler::deliver_events_ ( thread  t)
private

Read all event buffers for thread t and send the corresponding Events to the Nodes that are targeted.

Note
It is a crucial property of deliver_events_() that events are delivered ordered by non-decreasing time stamps. BUT: this ordering applies to time stamps only, it does NOT take into account the offsets of precise spikes.

Referenced by prepare_nodes().

void nest::Scheduler::ensure_valid_thread_local_ids ( )
inline

Ensure that all nodes in the network have valid thread-local IDs.

References update_nodes_vec_().

Referenced by nest::Network::ensure_valid_thread_local_ids().

void nest::Scheduler::finalize_ ( )
private

Finalize the scheduler by freeing the buffers and destoying the mutexes.

void nest::Scheduler::finalize_nodes ( )
private

Invoke finalize() on nodes registered for finalization.

Referenced by prepare_nodes().

void nest::Scheduler::finalize_simulation ( )
void nest::Scheduler::gather_events_ ( )
private

Collocate buffers and exchange events with other MPI processes.

Referenced by prepare_nodes().

thread nest::Scheduler::get_global_thread_id ( thread  lt) const

Return the global thread id of a local thread.

librandom::RngPtr nest::Scheduler::get_grng ( ) const
inline

Return pointer to global random number generator.

References grng_.

Referenced by nest::Network::get_grng().

delay nest::Scheduler::get_max_delay ( )
inlinestatic
delay nest::Scheduler::get_min_delay ( )
inlinestatic

Return minimal connection delay.

References min_delay_.

Referenced by nest::volume_transmitter::calibrate(), nest::ListRingBuffer::get_list(), nest::Network::get_min_delay(), nest::RingBuffer::get_value(), nest::MultRBuffer::get_value(), nest::correlomatrix_detector::handle(), nest::RingBuffer::resize(), nest::SliceRingBuffer::resize(), nest::MultRBuffer::resize(), nest::ListRingBuffer::resize(), nest::binary_neuron< TGainfunction >::update(), nest::iaf_psc_exp_multisynapse::update(), nest::pulsepacket_generator::update(), nest::iaf_psc_alpha_multisynapse::update(), nest::poisson_generator_ps::update(), nest::gamma_sup_generator::update(), nest::parrot_neuron_ps::update(), nest::ppd_sup_generator::update(), nest::parrot_neuron::update(), nest::sinusoidal_poisson_generator::update(), nest::aeif_cond_alpha_multisynapse::update(), nest::iaf_chs_2007::update(), nest::iaf_cond_exp::update(), nest::poisson_generator::update(), nest::izhikevich::update(), nest::sli_neuron::update(), nest::mip_generator::update(), nest::aeif_cond_alpha_RK5::update(), nest::volume_transmitter::update(), nest::iaf_chxk_2008::update(), nest::hh_cond_exp_traub::update(), nest::iaf_cond_exp_sfa_rr::update(), nest::iaf_cond_alpha::update(), nest::sinusoidal_gamma_generator::update(), nest::iaf_psc_exp::update(), nest::aeif_cond_alpha::update(), nest::iaf_neuron::update(), nest::iaf_psc_delta::update(), nest::mat2_psc_exp::update(), nest::aeif_cond_exp::update(), nest::iaf_psc_alpha::update(), nest::iaf_tum_2000::update(), nest::ht_neuron::update(), nest::amat2_psc_exp::update(), nest::hh_psc_alpha::update(), nest::pp_psc_delta::update(), nest::pp_pop_psc_delta::update(), nest::iaf_cond_alpha_mc::update(), nest::iaf_psc_alpha_presc::update(), nest::iaf_psc_exp_ps::update(), nest::iaf_psc_alpha_canon::update(), and nest::iaf_psc_delta_canon::update().

delay nest::Scheduler::get_modulo ( delay  d)
inlinestatic
index nest::Scheduler::get_n_gsd ( )
inline

Get total number of global spike detectors.

References n_gsd_.

Referenced by nest::Network::add_node().

thread nest::Scheduler::get_num_processes ( ) const
inline

Return the number of processes used during simulation.

This functions returns the number of processes. Since each process has the same number of threads, the total number of threads is given by get_num_threads()*get_num_processes().

References nest::Communicator::get_num_processes().

Referenced by nest::Network::get_num_processes().

thread nest::Scheduler::get_num_rec_processes ( ) const
inline
thread nest::Scheduler::get_num_sim_processes ( ) const
inline
thread nest::Scheduler::get_num_threads ( ) const
inline

Return the number of threads used during simulation.

This functions returns the number of threads per process. Since each process has the same number of threads, the total number of threads is given by get_num_threads()*get_num_processes().

References n_threads_.

Referenced by nest::Network::get_num_threads().

bool nest::Scheduler::get_off_grid_communication ( ) const
inline

return current communication style.

A result of true means off_grid, false means on_grid communication.

References off_grid_spiking_.

Referenced by nest::Network::get_off_grid_communication().

Time nest::Scheduler::get_previous_slice_origin ( ) const
inline

Time at beginning of previous slice.

References clock_, min_delay_, and nest::Time::step.

Referenced by nest::Network::get_previous_slice_origin().

thread nest::Scheduler::get_process_id ( thread  vp) const
inline

Return the process id for a given virtual process.

The real process' id of a virtual process is defined by the relation: p = (vp mod P), where P is the total number of processes.

References n_rec_procs_, n_sim_procs_, and n_threads_.

Referenced by is_local_vp().

librandom::RngPtr nest::Scheduler::get_rng ( const thread  thrd) const
inline

Return pointer to random number generator of the specified thread.

References assert(), and rng_.

Referenced by nest::Network::get_rng().

bool nest::Scheduler::get_simulated ( ) const
inline

Return true, if the network 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.)

References simulated_.

Referenced by nest::Network::get_simulated(), and nest::Network::reset_network().

size_t nest::Scheduler::get_slice ( ) const
inline

Get slice number.

Increased by one for each slice. Can be used to choose alternating buffers.

References slice_.

Referenced by nest::Network::write_toggle().

delay nest::Scheduler::get_slice_modulo ( delay  d)
inlinestatic

Index to slice-based buffer.

Return ((T+d)/min_delay) % ceil(max_delay/min_delay).

References assert(), nest::names::d, and slice_moduli_.

Referenced by nest::SliceRingBuffer::add_spike(), nest::SliceRingBuffer::discard_events(), and nest::SliceRingBuffer::prepare_delivery().

Time const & nest::Scheduler::get_slice_origin ( ) const
inline

Time at beginning of current slice.

References clock_.

Referenced by nest::Network::get_slice_origin().

void nest::Scheduler::get_status ( DictionaryDatum ) const
Time const nest::Scheduler::get_time ( ) const
inline

Precise time of simulation.

Note
The precise time of the simulation is defined only while the simulation is not in progress.

References assert(), clock_, from_step_, simulating_, and nest::Time::step.

Referenced by nest::Network::get_time().

void nest::Scheduler::increment_n_gsd ( )
inline

Increment total number of global spike detectors by 1.

References n_gsd_.

Referenced by nest::Network::add_node().

void nest::Scheduler::init_ ( )
private

Initialize the scheduler by initializing the buffers.

References assert(), nest::Communicator::get_num_processes(), and SLIInterpreter::M_ERROR.

Referenced by Scheduler().

void nest::Scheduler::init_moduli_ ( )
private

References assert(), and nest::names::d.

bool nest::Scheduler::is_local_node ( Node n) const
inline

Return true if the node on the local machine, false if not.

References nest::Node::get_vp(), and is_local_vp().

bool nest::Scheduler::is_local_vp ( thread  vp) const
inline

Return true if the thread is on the local machine, false if not.

References get_process_id(), and nest::Communicator::get_rank().

Referenced by is_local_node(), and nest::Network::is_local_vp().

void nest::Scheduler::prepare_node_ ( Node n)
inlineprivate

Initialized buffers, register in list of nodes to update/finalize.

See also
prepare_nodes()

References nest::Node::calibrate(), and nest::Node::init_buffers().

void nest::Scheduler::prepare_nodes ( )
private

Prepare nodes for simulation and register nodes in node_list.

Calls prepare_node_() for each pertaining Node.

See also
prepare_node_()

References ad, advance_time_(), assert(), collocate_buffers_(), nest::Communicator::communicate(), create_grng_(), librandom::RandomGen::create_knuthlfg_rng(), create_rngs_(), nest::names::d, librandom::RandomGen::DefaultSeed, deliver_events_(), numerics::e, nest::Node::finalize(), finalize_nodes(), gather_events_(), nest::Time::get_ms(), nest::Time::get_ms_per_tic(), nest::Communicator::get_num_processes(), nest::Communicator::get_num_virtual_processes(), nest::Communicator::get_recv_buffer_size(), nest::Time::get_resolution(), nest::Communicator::get_send_buffer_size(), get_status(), nest::Node::get_thread(), nest::Node::get_thread_sibling_(), nest::Time::get_tics_per_ms(), nest::Time::get_tics_per_step(), nest::Communicator::get_use_Allgather(), getValue< long >(), PoorMansAllocator::init(), nest::Node::is_subnet(), SLIInterpreter::M_ERROR, SLIInterpreter::M_INFO, SLIInterpreter::M_WARNING, nest::Time::max(), MAX_THREAD, nest::KernelException::message(), WrappedThreadException::message(), nest::DimensionMismatch::message(), nest::Time::min(), nest::names::n, nest::Node::num_thread_siblings_(), omp_set_num_threads(), print_progress_(), nest::Time::resolution_is_default(), seed, set_num_rec_processes(), set_num_threads(), nest::Communicator::set_num_threads(), nest::Event::set_offset(), nest::Time::set_resolution(), nest::Event::set_sender_gid(), nest::Event::set_stamp(), set_status(), nest::Node::set_thread_lid(), nest::TimeModifier::set_time_representation(), nest::Communicator::set_use_Allgather(), TokenArray::size(), nest::Time::step, nest::TimeZero, update_nodes_vec_(), and nest::names::vp.

void nest::Scheduler::prepare_simulation ( )
void nest::Scheduler::print_progress_ ( )
private

Referenced by prepare_nodes().

void nest::Scheduler::reset ( )

Bring scheduler back to its initial state.

Note
Threading parameters as well as random number state are not reset. This has to be done manually.

References nest::TimeModifier::reset_to_defaults().

Referenced by nest::Network::reset().

void nest::Scheduler::resume ( )
void nest::Scheduler::send_offgrid_remote ( thread  p,
SpikeEvent e,
const long_t  lag = 0 
)
inline

Add global id of event sender to the spike_register.

Store event offset with global id. An event sent through this method will remain in the queue until the network time has advanced by min_delay_ steps. After this period the buffers are collocated and sent to the partner machines.

Old documentation from network.h: Place an event in the global event queue. Add event to the queue to be delivered when it is due. At the delivery time, the target list of the sender is iterated and the event is delivered to all targets. The event is guaranteed to arrive at the receiver when all elements are updated and the system is in a synchronised (single threaded) state.

See also
send_to_targets()

References nest::Node::get_gid(), nest::SpikeEvent::get_multiplicity(), nest::Event::get_offset(), nest::Event::get_sender(), offgrid_spike_register_, and push_back().

void nest::Scheduler::send_remote ( thread  p,
SpikeEvent e,
const long_t  lag = 0 
)
inline

Add global id of event sender to the spike_register.

An event sent through this method will remain in the queue until the network time has advanced by min_delay_ steps. After this period the buffers are collocated and sent to the partner machines.

Old documentation from network.h: Place an event in the global event queue. Add event to the queue to be delivered when it is due. At the delivery time, the target list of the sender is iterated and the event is delivered to all targets. The event is guaranteed to arrive at the receiver when all elements are updated and the system is in a synchronised (single threaded) state.

See also
send_to_targets()

References nest::Node::get_gid(), nest::SpikeEvent::get_multiplicity(), nest::Event::get_sender(), push_back(), and spike_register_.

void nest::Scheduler::set_network_ ( Network )
void nest::Scheduler::set_num_rec_processes ( int  nrp,
bool  called_by_reset = false 
)

Set number of recording processes, switches NEST to global spike detection mode.

Parameters
nrpnumber of recording processes
called_by_resetpass true when calling from Scheduler::reset()
Note
The called_by_reset parameter is a cludge to avoid a chicken-and-egg problem when resetting the kernel. It surpresses a test for existing nodes, trusting that the kernel will immediately afterwards delete all existing nodes.

Referenced by prepare_nodes(), nest::Network::reset_kernel(), and nest::Network::set_num_rec_processes().

void nest::Scheduler::set_num_threads ( thread  n_threads)

Set the number of threads by setting the internal variable n_threads_, the corresponding value in the Communicator, and the OpenMP number of threads.

Referenced by prepare_nodes(), and nest::Network::reset_kernel().

void nest::Scheduler::set_off_grid_communication ( bool  off_grid_spiking)
inline

set communication style to off_grid (true) or on_grid

References off_grid_spiking_.

Referenced by nest::Network::add_node().

void nest::Scheduler::set_status ( const DictionaryDatum )
void nest::Scheduler::simulate ( Time const &  t)

Simulate for the given time .

This function performs the following steps

  1. set the new simulation time
  2. call prepare_simulation()
  3. call resume()
  4. call finalize_simulation()

References assert(), nest::Time::get_resolution(), nest::Time::get_steps(), nest::Time::is_finite(), SLIInterpreter::M_ERROR, SLIInterpreter::M_WARNING, and nest::Time::max().

Referenced by nest::Network::simulate().

thread nest::Scheduler::suggest_rec_vp ( index  gid) const
inline

Return a thread number for a given global recording node id.

Each node has a default thread on which it will run. The thread is defined by the relation: t = (gid div P) mod T, where P is the number of recording processes and T the number of threads. This may be used by network::add_node() if the user has not specified anything.

References n_rec_procs_, n_sim_procs_, and n_threads_.

Referenced by nest::Network::suggest_rec_vp().

thread nest::Scheduler::suggest_vp ( index  gid) const
inline

Return a thread number for a given global node id.

Each node has a default thread on which it will run. The thread is defined by the relation: t = (gid div P) mod T, where P is the number of simulation processes and T the number of threads. This may be used by network::add_node() if the user has not specified anything.

References n_sim_procs_, and n_threads_.

Referenced by nest::Network::suggest_vp().

void nest::Scheduler::terminate ( )
inline
Node * nest::Scheduler::thread_lid_to_node ( thread  t,
targetindex  thread_local_id 
) const
inline
thread nest::Scheduler::thread_to_vp ( thread  t) const
inline
void nest::Scheduler::update ( )

Update all non-frozen nodes.

This function uses OpenMP for multi-threading if enabled at configure time and runs with a single thread otherwise.

References nest::Communicator::advance_music_time(), numerics::e, SLIInterpreter::M_INFO, and SLIsignalflag.

void nest::Scheduler::update_delay_extrema_ ( )
staticprivate

Update delay extrema to current values.

Static since it only operates in static variables. This allows it to be called from const-method get_status() as well.

References nest::Communicator::communicate(), nest::Communicator::get_num_processes(), nest::Communicator::get_rank(), nest::Time::get_resolution(), nest::Time::get_steps(), and nest::Time::pos_inf().

void nest::Scheduler::update_nodes_vec_ ( )
private

Create up-to-date vector of local nodes, nodes_vec_.

This method also sets the thread-local ID on all local nodes.

Referenced by ensure_valid_thread_local_ids(), and prepare_nodes().

thread nest::Scheduler::vp_to_thread ( thread  vp) const
inline

Member Data Documentation

Time nest::Scheduler::clock_
private

Network clock, updated once per slice.

Referenced by calibrate_clock(), get_previous_slice_origin(), get_slice_origin(), and get_time().

const nest::delay nest::Scheduler::comm_marker_ = 0
staticprivate

Marker Value to be put between the data fields from different time steps during communication.

std::vector<int> nest::Scheduler::displacements_
private

Buffer containing the starting positions for the spikes from each process within the global_(off)grid_spikes_ buffer.

volatile index nest::Scheduler::entry_counter_
private

Counter for entry barrier.

volatile index nest::Scheduler::exit_counter_
private

Counter for exit barrier.

bool nest::Scheduler::force_singlethreading_
private
delay nest::Scheduler::from_step_
private

update clock_+from_step<=T<clock_+to_step_

Referenced by get_time().

std::vector<uint_t> nest::Scheduler::global_grid_spikes_
private

Buffer containing the gids of all neurons that spiked in the last min_delay_ interval.

The single slices are separated by a marker value

std::vector<OffGridSpike> nest::Scheduler::global_offgrid_spikes_
private

Buffer containing the gids and offsets for all neurons that fired off-grid spikes in the last min_delay_ interval.

The single slices are separated by a marker value.

librandom::RngPtr nest::Scheduler::grng_
private

Global random number generator.

This rng must be synchronized on all threads

Referenced by get_grng().

long_t nest::Scheduler::grng_seed_
private

The seed of the global RNG, not neccessarily describing the state of the GRNG.

bool nest::Scheduler::initialized_
private
std::vector<uint_t> nest::Scheduler::local_grid_spikes_
private

Buffer containing the gids of local neurons that spiked in the last min_delay_ interval.

The single slices are separated by a marker value.

std::vector<OffGridSpike> nest::Scheduler::local_offgrid_spikes_
private

Buffer containing the gids and offsets for local neurons that fired off-grid spikes in the last min_delay_ interval.

The single slices are separated by a marker value.

nest::delay nest::Scheduler::max_delay_ = 1
staticprivate

Value of the largest delay in the network.

Static because get_max_delay() must be static to allow access from neuron models.

Referenced by get_max_delay().

nest::delay nest::Scheduler::min_delay_ = 1
staticprivate

Value of the smallest delay in the network.

Static because get_min_delay() must be static to allow access from neuron models.

Referenced by get_min_delay(), and get_previous_slice_origin().

std::vector< nest::delay > nest::Scheduler::moduli_
staticprivate

Table of pre-computed modulos.

This table is used to map time steps, given as offset from now, to ring-buffer bins. There are min_delay+max_delay bins in a ring buffer, and the moduli_ array is rotated by min_delay elements after each slice is completed.

See also
RingBuffer

Referenced by get_modulo().

index nest::Scheduler::n_gsd_
private

Total number of global spike detectors, used for distributing them over recording processes.

Referenced by get_n_gsd(), and increment_n_gsd().

index nest::Scheduler::n_rec_procs_
private

MPI processes dedicated for recording devices.

Referenced by get_num_rec_processes(), get_process_id(), suggest_rec_vp(), thread_to_vp(), and vp_to_thread().

index nest::Scheduler::n_sim_procs_
private

MPI processes used for simulation.

Referenced by get_num_sim_processes(), get_process_id(), suggest_rec_vp(), suggest_vp(), thread_to_vp(), and vp_to_thread().

index nest::Scheduler::n_threads_
private

Number of threads per process.

Referenced by get_num_threads(), get_process_id(), suggest_rec_vp(), suggest_vp(), thread_to_vp(), and vp_to_thread().

nest::Network * nest::Scheduler::net_ = 0
staticprivate

Pointer to network object.

Maintained as a static pointer so that update_delay_extrema_() can be a static function and update thet static min/max_delay_ variables even from get_status() const.

Referenced by Scheduler().

vector<vector<Node*> > nest::Scheduler::nodes_vec_
private

Nodelists for nodes for each thread.

Referenced by thread_lid_to_node().

index nest::Scheduler::nodes_vec_network_size_
private

Network size when nodes_vec_ was last updated.

bool nest::Scheduler::off_grid_spiking_
private

indicates whether spikes are not constrained to the grid

Referenced by get_off_grid_communication(), and set_off_grid_communication().

std::vector<std::vector<std::vector<OffGridSpike> > > nest::Scheduler::offgrid_spike_register_
private

Register for off-grid spikes.

This is a 3-dim structure.

  • First dim: Each thread has its own vector to write to.
  • Second dim: A vector for each slice of the min_delay interval
  • Third dim: Struct containing GID and offset.

Referenced by send_offgrid_remote().

bool nest::Scheduler::print_time_
private

Indicates whether time should be printed during simulations (or not)

vector<librandom::RngPtr> nest::Scheduler::rng_
private

Vector of random number generators for threads.

There must be PRECISELY one rng per thread.

Referenced by get_rng().

std::vector<long_t> nest::Scheduler::rng_seeds_
private

The seeds of the local RNGs. These do not neccessarily describe the state of the RNGs.

bool nest::Scheduler::simulated_
private

indicates whether the network has already been simulated for some time

Referenced by get_simulated().

bool nest::Scheduler::simulating_
private

true if simulation in progress

Referenced by get_time().

delay nest::Scheduler::slice_
private

current update slice

Referenced by get_slice().

std::vector< nest::delay > nest::Scheduler::slice_moduli_
staticprivate

Table of pre-computed slice-based modulos.

This table is used to map time steps, give as offset from now, to slice-based ring-buffer bins. There are ceil(max_delay/min_delay) bins in a slice-based ring buffer, one per slice within max_delay. Since max_delay may not be a multiple of min_delay, we cannot simply rotate the table content after each slice, but have to recompute the table anew.

See also
SliceRingBuffer

Referenced by get_slice_modulo().

std::vector<std::vector<std::vector<uint_t> > > nest::Scheduler::spike_register_
private

Register for gids of neurons that spiked.

This is a 3-dim structure.

  • First dim: Each thread has its own vector to write to.
  • Second dim: A vector for each slice of the min_delay interval
  • Third dim: The gids.

Referenced by send_remote().

long nest::Scheduler::t_real_
private

Accumunated wall-clock time spent simulating (in us)

timeval nest::Scheduler::t_slice_begin_
private

Wall-clock time at the begin of a time slice.

timeval nest::Scheduler::t_slice_end_
private

Wall-clock time at the end of time slice.

bool nest::Scheduler::terminate_
private

Terminate on signal or error.

Referenced by terminate().

delay nest::Scheduler::to_do_
private

number of pending cycles.

delay nest::Scheduler::to_do_total_
private

number of requested cycles in current simulation.

delay nest::Scheduler::to_step_
private

update clock_+from_step<=T<clock_+to_step_


The documentation for this class was generated from the following files: