NEST main@caf0ae8
 
Loading...
Searching...
No Matches
nest::EventDeliveryManager Class Reference

#include <event_delivery_manager.h>

Inheritance diagram for nest::EventDeliveryManager:
[legend]
Collaboration diagram for nest::EventDeliveryManager:
[legend]

Public Member Functions

 EventDeliveryManager ()
 
 ~EventDeliveryManager () override
 
void initialize (const bool) override
 Prepare manager for operation.
 
void finalize (const bool) override
 Take down manager after operation.
 
void set_status (const Dictionary &) override
 Set the status of the manager.
 
void get_status (Dictionary &) override
 Retrieve the status of the manager.
 
template<class EventT >
void send (Node &source, EventT &e, const long lag=0)
 Standard routine for sending events.
 
void send_secondary (Node &source, SecondaryEvent &e)
 Send a secondary event remote.
 
void send_local (size_t t, Node &source, Event &e)
 Send event e to all targets of node source on thread t.
 
void send_remote (size_t tid, SpikeEvent &, const long lag=0)
 Add node ID of event sender to the spike_register.
 
void send_off_grid_remote (size_t tid, SpikeEvent &e, const long lag=0)
 Add node ID of event sender to the spike_register.
 
void send_to_node (Event &e)
 Send event e directly to its target node.
 
bool get_off_grid_communication () const
 return current communication style.
 
void set_off_grid_communication (bool off_grid_spiking)
 set communication style to off_grid (true) or on_grid
 
size_t write_toggle () const
 Return 0 for even, 1 for odd time slices.
 
size_t read_toggle () const
 Return 1 - write_toggle().
 
long get_modulo (long d)
 Return (T+d) mod max_delay.
 
long get_slice_modulo (long d)
 Index to slice-based buffer.
 
void configure_spike_data_buffers ()
 Resize spike_register and comm_buffer to correct dimensions.
 
void configure_spike_register ()
 
void resize_send_recv_buffers_target_data ()
 
void configure_secondary_buffers ()
 
void gather_spike_data ()
 Collocates spikes from register to MPI buffers, communicates via MPI and delivers events to targets.
 
void gather_target_data (const size_t tid)
 Collocates presynaptic connection information, communicates via MPI and creates presynaptic connection infrastructure.
 
void gather_target_data_compressed (const size_t tid)
 
void deliver_events (const size_t tid)
 Delivers events to targets.
 
void gather_secondary_target_data ()
 Collocates presynaptic connection information for secondary events (MPI buffer offsets), communicates via MPI and create presynaptic connection infrastructure for secondary events.
 
void write_done_marker_secondary_events_ (const bool done)
 
void gather_secondary_events (const bool done)
 
bool deliver_secondary_events (const size_t tid, const bool called_from_wfr_update)
 
void update_moduli ()
 Update modulo table based on current time settings.
 
void init_moduli ()
 Initialize modulo table.
 
virtual void reset_counters ()
 Set local spike counter to zero.
 
virtual void reset_timers_for_preparation ()
 Set time measurements for internal profiling to zero (reg.
 
virtual void reset_timers_for_dynamics ()
 Set time measurements for internal profiling to zero (reg.
 
template<>
void send (Node &source, SpikeEvent &e, const long lag)
 
template<>
void send (Node &source, DSSpikeEvent &e, const long lag)
 
- Public Member Functions inherited from nest::ManagerInterface
 ManagerInterface (ManagerInterface const &)=delete
 
void operator= (ManagerInterface const &)=delete
 
 ManagerInterface ()
 
virtual ~ManagerInterface ()
 
virtual void prepare ()
 
virtual void cleanup ()
 

Private Member Functions

template<typename SpikeDataT >
void gather_spike_data_ (std::vector< SpikeDataT > &send_buffer, std::vector< SpikeDataT > &recv_buffer)
 
void resize_send_recv_buffers_spike_data_ ()
 
template<typename SpikeDataWithRankT , typename SpikeDataT >
void collocate_spike_data_buffers_ (SendBufferPosition &send_buffer_position, std::vector< std::vector< SpikeDataWithRankT > * > &spike_register, std::vector< SpikeDataT > &send_buffer, std::vector< size_t > &num_spikes_per_rank)
 Moves spikes from on grid and off grid spike registers to correct locations in MPI buffers.
 
template<typename SpikeDataT >
void set_end_marker_ (const SendBufferPosition &send_buffer_position, std::vector< SpikeDataT > &send_buffer, size_t local_max_spikes_per_rank)
 Set end marker for per-rank-chunks signalling completion and providing shrink/grow information.
 
template<typename SpikeDataT >
void reset_complete_marker_spike_data_ (const SendBufferPosition &send_buffer_position, std::vector< SpikeDataT > &send_buffer) const
 Resets marker in MPI buffer that signals end of communication across MPI ranks.
 
template<typename SpikeDataT >
size_t get_global_max_spikes_per_rank_ (const SendBufferPosition &send_buffer_position, std::vector< SpikeDataT > &recv_buffer) const
 Get required buffer size.
 
template<typename SpikeDataT >
void deliver_events_ (const size_t tid, const std::vector< SpikeDataT > &recv_buffer)
 Reads spikes from MPI buffers and delivers them to ringbuffer of nodes.
 
void reset_spike_register_ (const size_t tid)
 Deletes all spikes from spike registers and resets spike counters.
 
bool collocate_target_data_buffers_ (const size_t tid, const AssignedRanks &assigned_ranks, TargetSendBufferPosition &send_buffer_position)
 Fills MPI buffer for communication of connection information from presynaptic to postsynaptic side.
 
bool collocate_target_data_buffers_compressed_ (const size_t tid, const AssignedRanks &assigned_ranks, TargetSendBufferPosition &send_buffer_position)
 
void set_complete_marker_target_data_ (const AssignedRanks &assigned_ranks, const TargetSendBufferPosition &send_buffer_position)
 Sets marker in MPI buffer that signals end of communication across MPI ranks.
 
bool distribute_target_data_buffers_ (const size_t tid)
 Reads TargetData objects from MPI buffers and creates Target objects on TargetTable (presynaptic part of connection infrastructure).
 
template<class EventT >
void send_local_ (Node &source, EventT &e, const long lag)
 Sends event e to all targets of node source.
 
void send_local_ (Node &source, SecondaryEvent &e, const long lag)
 

Static Private Member Functions

static bool is_marked_for_removal_ (const Target &target)
 Returns true if spike has been moved to MPI buffer, such that it can be removed by clean_spike_register.
 

Private Attributes

bool off_grid_spiking_
 indicates whether spikes are not constrained to the grid
 
std::vector< long > moduli_
 Table of pre-computed modulos.
 
std::vector< long > slice_moduli_
 Table of pre-computed slice-based modulos.
 
std::vector< std::vector< SpikeDataWithRank > * > emitted_spikes_register_
 Register of emitted spikes.
 
std::vector< std::vector< OffGridSpikeDataWithRank > * > off_grid_emitted_spikes_register_
 Register of emitted off-grid spikes.
 
std::vector< unsigned int > send_buffer_secondary_events_
 Buffer to collect the secondary events after serialization.
 
std::vector< unsigned int > recv_buffer_secondary_events_
 
std::vector< unsigned long > local_spike_counter_
 Number of generated spike events (both off- and on-grid) during the last call to simulate.
 
std::vector< SpikeData > send_buffer_spike_data_
 
std::vector< SpikeData > recv_buffer_spike_data_
 
std::vector< OffGridSpikeData > send_buffer_off_grid_spike_data_
 
std::vector< OffGridSpikeData > recv_buffer_off_grid_spike_data_
 
std::vector< TargetData > send_buffer_target_data_
 
std::vector< TargetData > recv_buffer_target_data_
 
bool buffer_size_target_data_has_changed_
 whether size of MPI buffer for communication of connections was changed
 
size_t global_max_spikes_per_rank_
 Largest number of spikes sent from any rank to any other rank in last spike exchange round.
 
double send_recv_buffer_shrink_limit_
 shrink buffer only if below this limit
 
double send_recv_buffer_shrink_spare_
 leave this fraction more space than minimally needed
 
double send_recv_buffer_grow_extra_
 when growing, add this fraction extra space
 
BufferResizeLog send_recv_buffer_resize_log_
 Log all resize events.
 
PerThreadBoolIndicator gather_completed_checker_
 
Stopwatch< StopwatchGranularity::Detailed, StopwatchParallelism::MasterOnly > sw_collocate_spike_data_
 
Stopwatch< StopwatchGranularity::Detailed, StopwatchParallelism::MasterOnly > sw_communicate_spike_data_
 
Stopwatch< StopwatchGranularity::Detailed, StopwatchParallelism::MasterOnly > sw_communicate_target_data_
 

Constructor & Destructor Documentation

◆ EventDeliveryManager()

nest::EventDeliveryManager::EventDeliveryManager ( )

◆ ~EventDeliveryManager()

nest::EventDeliveryManager::~EventDeliveryManager ( )
override

Member Function Documentation

◆ collocate_spike_data_buffers_()

template<typename SpikeDataWithRankT , typename SpikeDataT >
void nest::EventDeliveryManager::collocate_spike_data_buffers_ ( SendBufferPosition &  send_buffer_position,
std::vector< std::vector< SpikeDataWithRankT > * > &  spike_register,
std::vector< SpikeDataT > &  send_buffer,
std::vector< size_t > &  num_spikes_per_rank 
)
private

Moves spikes from on grid and off grid spike registers to correct locations in MPI buffers.

Accumulates count of spikes to be sent to any rank in num_spikes_per_rank. Passed as argument, so that values accumulate as we call once for plain and once for offgrid spikes.

References nest::SendBufferPosition::idx(), nest::SendBufferPosition::increase(), and nest::SendBufferPosition::is_chunk_filled().

Referenced by gather_spike_data_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ collocate_target_data_buffers_()

bool nest::EventDeliveryManager::collocate_target_data_buffers_ ( const size_t  tid,
const AssignedRanks &  assigned_ranks,
TargetSendBufferPosition &  send_buffer_position 
)
private

Fills MPI buffer for communication of connection information from presynaptic to postsynaptic side.

Builds TargetData objects from SourceTable and connections information.

References nest::TargetSendBufferPosition::are_all_chunks_filled(), nest::TargetSendBufferPosition::begin(), nest::AssignedRanks::begin, nest::KernelManager::connection_manager, nest::TargetSendBufferPosition::end(), nest::AssignedRanks::end, nest::ConnectionManager::get_next_target_data(), nest::TargetSendBufferPosition::idx(), nest::TargetSendBufferPosition::increase(), nest::TargetSendBufferPosition::is_chunk_filled(), nest::kernel(), nest::ConnectionManager::no_targets_to_process(), nest::ConnectionManager::reject_last_target_data(), nest::ConnectionManager::save_source_table_entry_point(), and send_buffer_target_data_.

Referenced by gather_target_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ collocate_target_data_buffers_compressed_()

bool nest::EventDeliveryManager::collocate_target_data_buffers_compressed_ ( const size_t  tid,
const AssignedRanks &  assigned_ranks,
TargetSendBufferPosition &  send_buffer_position 
)
private

References nest::TargetSendBufferPosition::begin(), nest::AssignedRanks::begin, nest::KernelManager::connection_manager, nest::TargetSendBufferPosition::end(), nest::AssignedRanks::end, nest::ConnectionManager::fill_target_buffer(), nest::kernel(), and send_buffer_target_data_.

Referenced by gather_target_data_compressed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ configure_secondary_buffers()

void nest::EventDeliveryManager::configure_secondary_buffers ( )

References nest::kernel(), recv_buffer_secondary_events_, and send_buffer_secondary_events_.

Referenced by nest::SimulationManager::update_connection_infrastructure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ configure_spike_data_buffers()

void nest::EventDeliveryManager::configure_spike_data_buffers ( )

Resize spike_register and comm_buffer to correct dimensions.

Resizes also off_grid_*_buffer_. This is done by simulate() 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 Network::set_status() ensure this.

References configure_spike_register(), nest::kernel(), resize_send_recv_buffers_spike_data_(), send_buffer_off_grid_spike_data_, and send_buffer_spike_data_.

Referenced by nest::SimulationManager::prepare(), and nest::SimulationManager::set_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ configure_spike_register()

void nest::EventDeliveryManager::configure_spike_register ( )

References nest::VPManager::get_thread_id(), nest::kernel(), reset_spike_register_(), and nest::KernelManager::vp_manager.

Referenced by configure_spike_data_buffers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deliver_events()

void nest::EventDeliveryManager::deliver_events ( const size_t  tid)

Delivers events to targets.

References deliver_events_(), off_grid_spiking_, recv_buffer_off_grid_spike_data_, recv_buffer_spike_data_, and reset_spike_register_().

Referenced by nest::SimulationManager::update_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deliver_events_()

template<typename SpikeDataT >
void nest::EventDeliveryManager::deliver_events_ ( const size_t  tid,
const std::vector< SpikeDataT > &  recv_buffer 
)
private

Reads spikes from MPI buffers and delivers them to ringbuffer of nodes.

References nest::KernelManager::connection_manager, nest::SimulationManager::get_clock(), nest::ConnectionManager::get_compressed_spike_data(), nest::ModelManager::get_connection_models(), nest::MPIManager::get_num_processes(), nest::MPIManager::get_send_recv_count_spike_data_per_rank(), nest::invalid_lcid, nest::kernel(), nest::KernelManager::model_manager, nest::KernelManager::mpi_manager, nest::ConnectionManager::send(), nest::Event::set_flush_event_flag(), nest::Event::set_offset(), nest::Event::set_sender_node_id_info(), nest::Event::set_stamp(), nest::KernelManager::simulation_manager, and nest::ConnectionManager::use_compressed_spikes().

Referenced by deliver_events().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deliver_secondary_events()

bool nest::EventDeliveryManager::deliver_secondary_events ( const size_t  tid,
const bool  called_from_wfr_update 
)

References nest::KernelManager::connection_manager, nest::ConnectionManager::deliver_secondary_events(), nest::kernel(), and recv_buffer_secondary_events_.

Referenced by nest::SimulationManager::update_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distribute_target_data_buffers_()

bool nest::EventDeliveryManager::distribute_target_data_buffers_ ( const size_t  tid)
private

Reads TargetData objects from MPI buffers and creates Target objects on TargetTable (presynaptic part of connection infrastructure).

References nest::ConnectionManager::add_target(), nest::KernelManager::connection_manager, nest::MPIManager::get_num_processes(), nest::MPIManager::get_send_recv_count_target_data_per_rank(), nest::TargetData::get_source_tid(), nest::TargetData::is_end_marker(), nest::kernel(), nest::KernelManager::mpi_manager, and recv_buffer_target_data_.

Referenced by gather_target_data(), and gather_target_data_compressed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalize()

void nest::EventDeliveryManager::finalize ( const bool  adjust_number_of_threads_or_rng_only)
overridevirtual

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.

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_onlyPass true if calling from kernel_manager::change_number_of_threads() to limit operations to those necessary for thread adjustment.
See also
initialize()

Implements nest::ManagerInterface.

References emitted_spikes_register_, off_grid_emitted_spikes_register_, recv_buffer_off_grid_spike_data_, recv_buffer_secondary_events_, recv_buffer_spike_data_, send_buffer_off_grid_spike_data_, send_buffer_secondary_events_, and send_buffer_spike_data_.

◆ gather_secondary_events()

void nest::EventDeliveryManager::gather_secondary_events ( const bool  done)

References nest::MPIManager::communicate_secondary_events_Alltoallv(), nest::kernel(), nest::KernelManager::mpi_manager, recv_buffer_secondary_events_, send_buffer_secondary_events_, and write_done_marker_secondary_events_().

Referenced by nest::SimulationManager::update_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gather_secondary_target_data()

void nest::EventDeliveryManager::gather_secondary_target_data ( )

Collocates presynaptic connection information for secondary events (MPI buffer offsets), communicates via MPI and create presynaptic connection infrastructure for secondary events.

◆ gather_spike_data()

void nest::EventDeliveryManager::gather_spike_data ( )

Collocates spikes from register to MPI buffers, communicates via MPI and delivers events to targets.

References gather_spike_data_(), off_grid_spiking_, recv_buffer_off_grid_spike_data_, recv_buffer_spike_data_, send_buffer_off_grid_spike_data_, and send_buffer_spike_data_.

Referenced by nest::SimulationManager::update_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gather_spike_data_()

◆ gather_target_data()

void nest::EventDeliveryManager::gather_target_data ( const size_t  tid)

Collocates presynaptic connection information, communicates via MPI and creates presynaptic connection infrastructure.

References nest::PerThreadBoolIndicator::all_false(), nest::PerThreadBoolIndicator::all_true(), nest::PerThreadBoolIndicator::any_false(), buffer_size_target_data_has_changed_, nest::ConnectionManager::clean_source_table(), nest::ConnectionManager::clear_source_table(), collocate_target_data_buffers_(), nest::MPIManager::communicate_target_data_Alltoall(), nest::KernelManager::connection_manager, distribute_target_data_buffers_(), gather_completed_checker_, nest::VPManager::get_assigned_ranks(), nest::KernelManager::get_omp_synchronization_construction_stopwatch(), nest::MPIManager::increase_buffer_size_target_data(), nest::kernel(), nest::PerThreadBoolIndicator::logical_and(), nest::KernelManager::mpi_manager, nest::ConnectionManager::prepare_target_table(), recv_buffer_target_data_, nest::ConnectionManager::reset_source_table_entry_point(), resize_send_recv_buffers_target_data(), nest::ConnectionManager::restore_source_table_entry_point(), nest::ConnectionManager::save_source_table_entry_point(), send_buffer_target_data_, set_complete_marker_target_data_(), nest::PerThreadBoolIndicator::set_false(), nest::PerThreadBoolIndicator::set_true(), nest::Stopwatch< detailed_timer, threaded_timer >::start(), nest::Stopwatch< detailed_timer, threaded_timer >::stop(), sw_communicate_target_data_, and nest::KernelManager::vp_manager.

Referenced by nest::SimulationManager::update_connection_infrastructure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gather_target_data_compressed()

void nest::EventDeliveryManager::gather_target_data_compressed ( const size_t  tid)

◆ get_global_max_spikes_per_rank_()

template<typename SpikeDataT >
size_t nest::EventDeliveryManager::get_global_max_spikes_per_rank_ ( const SendBufferPosition &  send_buffer_position,
std::vector< SpikeDataT > &  recv_buffer 
) const
private

Get required buffer size.

Returns
maximum of required buffer sizes communicated by all ranks

References nest::SendBufferPosition::end(), nest::MPIManager::get_num_processes(), nest::MPIManager::get_send_recv_count_spike_data_per_rank(), nest::kernel(), and nest::KernelManager::mpi_manager.

Referenced by gather_spike_data_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_modulo()

long nest::EventDeliveryManager::get_modulo ( long  d)
inline

◆ get_off_grid_communication()

bool nest::EventDeliveryManager::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_.

◆ get_slice_modulo()

long nest::EventDeliveryManager::get_slice_modulo ( long  d)
inline

Index to slice-based buffer.

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

References slice_moduli_.

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

Here is the caller graph for this function:

◆ get_status()

void nest::EventDeliveryManager::get_status ( Dictionary &  )
overridevirtual

◆ init_moduli()

void nest::EventDeliveryManager::init_moduli ( )

Initialize modulo table.

TODO: can probably be private

References nest::KernelManager::connection_manager, nest::SimulationManager::get_clock(), nest::ConnectionManager::get_max_delay(), nest::ConnectionManager::get_min_delay(), nest::Time::get_steps(), nest::kernel(), moduli_, nest::KernelManager::simulation_manager, and slice_moduli_.

Referenced by initialize(), and nest::SimulationManager::prepare().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize()

void nest::EventDeliveryManager::initialize ( const bool  adjust_number_of_threads_or_rng_only)
overridevirtual

Prepare manager for operation.

After this method has completed, the manager should be completely initialized and "ready for action".

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_onlyPass 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.
See also
finalize()

Implements nest::ManagerInterface.

References buffer_size_target_data_has_changed_, nest::BufferResizeLog::clear(), emitted_spikes_register_, gather_completed_checker_, nest::VPManager::get_num_threads(), nest::VPManager::get_thread_id(), init_moduli(), nest::PerThreadBoolIndicator::initialize(), nest::kernel(), local_spike_counter_, off_grid_emitted_spikes_register_, off_grid_spiking_, reset_counters(), reset_timers_for_dynamics(), reset_timers_for_preparation(), send_recv_buffer_grow_extra_, send_recv_buffer_resize_log_, send_recv_buffer_shrink_limit_, send_recv_buffer_shrink_spare_, and nest::KernelManager::vp_manager.

Here is the call graph for this function:

◆ is_marked_for_removal_()

bool nest::EventDeliveryManager::is_marked_for_removal_ ( const Target &  target)
inlinestaticprivate

Returns true if spike has been moved to MPI buffer, such that it can be removed by clean_spike_register.

Required static function by std::remove_if.

◆ read_toggle()

size_t nest::EventDeliveryManager::read_toggle ( ) const
inline

Return 1 - write_toggle().

This is useful for buffers that need to be read alternatingly by slice. The value is given by 1-write_toggle().

See also
write_toggle

References write_toggle().

Here is the call graph for this function:

◆ reset_complete_marker_spike_data_()

template<typename SpikeDataT >
void nest::EventDeliveryManager::reset_complete_marker_spike_data_ ( const SendBufferPosition &  send_buffer_position,
std::vector< SpikeDataT > &  send_buffer 
) const
private

Resets marker in MPI buffer that signals end of communication across MPI ranks.

References nest::SendBufferPosition::end(), nest::MPIManager::get_num_processes(), nest::kernel(), and nest::KernelManager::mpi_manager.

Referenced by gather_spike_data_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_counters()

void nest::EventDeliveryManager::reset_counters ( )
virtual

Set local spike counter to zero.

References local_spike_counter_.

Referenced by initialize(), and nest::SimulationManager::run().

Here is the caller graph for this function:

◆ reset_spike_register_()

void nest::EventDeliveryManager::reset_spike_register_ ( const size_t  tid)
inlineprivate

Deletes all spikes from spike registers and resets spike counters.

References emitted_spikes_register_, and off_grid_emitted_spikes_register_.

Referenced by configure_spike_register(), and deliver_events().

Here is the caller graph for this function:

◆ reset_timers_for_dynamics()

void nest::EventDeliveryManager::reset_timers_for_dynamics ( )
virtual

Set time measurements for internal profiling to zero (reg.

sim. dyn.)

References nest::Stopwatch< detailed_timer, threaded_timer >::reset(), sw_collocate_spike_data_, and sw_communicate_spike_data_.

Referenced by nest::KernelManager::change_number_of_threads(), initialize(), and nest::SimulationManager::prepare().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_timers_for_preparation()

void nest::EventDeliveryManager::reset_timers_for_preparation ( )
virtual

Set time measurements for internal profiling to zero (reg.

prep.)

References nest::Stopwatch< detailed_timer, threaded_timer >::reset(), and sw_communicate_target_data_.

Referenced by nest::KernelManager::change_number_of_threads(), and initialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize_send_recv_buffers_spike_data_()

void nest::EventDeliveryManager::resize_send_recv_buffers_spike_data_ ( )
private

References nest::kernel(), recv_buffer_off_grid_spike_data_, recv_buffer_spike_data_, send_buffer_off_grid_spike_data_, and send_buffer_spike_data_.

Referenced by configure_spike_data_buffers(), and gather_spike_data_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize_send_recv_buffers_target_data()

void nest::EventDeliveryManager::resize_send_recv_buffers_target_data ( )

References nest::kernel(), recv_buffer_target_data_, and send_buffer_target_data_.

Referenced by gather_target_data(), gather_target_data_compressed(), and nest::SimulationManager::update_connection_infrastructure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send() [1/3]

template<>
void nest::EventDeliveryManager::send ( Node &  source,
DSSpikeEvent &  e,
const long  lag 
)
inline

References send_local_().

Here is the call graph for this function:

◆ send() [2/3]

template<class EventT >
void nest::EventDeliveryManager::send ( Node &  source,
EventT &  e,
const long  lag = 0 
)
inline

Standard routine for sending events.

This method decides if the event has to be delivered locally or globally. It exists to keep a clean and unitary interface for the event sending mechanism.

Note
Only specializations of SpikeEvent send remotely. A specialization for DSSpikeEvent exists to avoid that these events are sent to remote processes.
See also
send_local()

References send_local_().

Referenced by nest::iaf_psc_exp_ps::emit_instant_spike_(), nest::iaf_psc_exp_ps_lossless::emit_instant_spike_(), nest::iaf_psc_alpha_ps::emit_instant_spike_(), nest::iaf_psc_delta_ps::emit_instant_spike_(), nest::iaf_psc_exp_ps::emit_spike_(), nest::iaf_psc_exp_ps_lossless::emit_spike_(), nest::iaf_psc_delta_ps::emit_spike_(), nest::iaf_psc_alpha_ps::emit_spike_(), nest::iaf_chs_2007::update(), nest::iaf_psc_exp::update(), nest::iaf_tum_2000::update(), nest::ignore_and_fire::update(), nest::ac_generator::update(), nest::amat2_psc_exp::update(), nest::binary_neuron< TGainfunction >::update(), nest::cm_default::update(), nest::dc_generator::update(), nest::eprop_iaf::update(), nest::eprop_iaf_adapt::update(), nest::eprop_iaf_adapt_bsshslm_2020::update(), nest::eprop_iaf_bsshslm_2020::update(), nest::eprop_iaf_psc_delta::update(), nest::eprop_iaf_psc_delta_adapt::update(), nest::gamma_sup_generator::update(), nest::gif_psc_exp::update(), nest::gif_psc_exp_multisynapse::update(), nest::glif_psc::update(), nest::glif_psc_double_alpha::update(), nest::iaf_psc_alpha::update(), nest::iaf_psc_alpha_multisynapse::update(), nest::iaf_psc_delta::update(), nest::iaf_psc_exp_htum::update(), nest::iaf_psc_exp_multisynapse::update(), nest::inhomogeneous_poisson_generator::update(), nest::izhikevich::update(), nest::mat2_psc_exp::update(), nest::mip_generator::update(), nest::multimeter::update(), nest::noise_generator::update(), nest::parrot_neuron::update(), nest::parrot_neuron_ps::update(), nest::poisson_generator::update(), nest::poisson_generator_ps::update(), nest::pp_psc_delta::update(), nest::ppd_sup_generator::update(), nest::pulsepacket_generator::update(), nest::sinusoidal_poisson_generator::update(), nest::spike_dilutor::update(), nest::spike_generator::update(), nest::spike_train_injector::update(), and nest::step_current_generator::update().

Here is the call graph for this function:

◆ send() [3/3]

template<>
void nest::EventDeliveryManager::send ( Node &  source,
SpikeEvent &  e,
const long  lag 
)
inline

References nest::KernelManager::connection_manager, nest::kernel(), local_spike_counter_, send_local_(), send_off_grid_remote(), send_remote(), and nest::ConnectionManager::send_to_devices().

Here is the call graph for this function:

◆ send_local()

void nest::EventDeliveryManager::send_local ( size_t  t,
Node &  source,
Event &  e 
)

Send event e to all targets of node source on thread t.

◆ send_local_() [1/2]

template<class EventT >
void nest::EventDeliveryManager::send_local_ ( Node &  source,
EventT &  e,
const long  lag 
)
inlineprivate

Sends event e to all targets of node source.

Delivers events from devices directly to targets.

References nest::KernelManager::connection_manager, nest::kernel(), and nest::ConnectionManager::send_from_device().

Referenced by send(), send(), send(), and send_secondary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_local_() [2/2]

void nest::EventDeliveryManager::send_local_ ( Node &  source,
SecondaryEvent &  e,
const long  lag 
)
inlineprivate

References nest::KernelManager::connection_manager, nest::kernel(), and nest::ConnectionManager::send_from_device().

Here is the call graph for this function:

◆ send_off_grid_remote()

void nest::EventDeliveryManager::send_off_grid_remote ( size_t  tid,
SpikeEvent &  e,
const long  lag = 0 
)
inline

Add node ID of event sender to the spike_register.

Store event offset with node 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::KernelManager::connection_manager, nest::ConnectionManager::get_remote_targets_of_local_node(), nest::kernel(), nest::VPManager::node_id_to_lid(), off_grid_emitted_spikes_register_, and nest::KernelManager::vp_manager.

Referenced by send().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_remote()

void nest::EventDeliveryManager::send_remote ( size_t  tid,
SpikeEvent &  e,
const long  lag = 0 
)
inline

Add node 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::KernelManager::connection_manager, emitted_spikes_register_, nest::ConnectionManager::get_remote_targets_of_local_node(), nest::kernel(), nest::VPManager::node_id_to_lid(), and nest::KernelManager::vp_manager.

Referenced by send().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_secondary()

void nest::EventDeliveryManager::send_secondary ( Node &  source,
SecondaryEvent &  e 
)
inline

Send a secondary event remote.

References nest::KernelManager::connection_manager, nest::ConnectionManager::get_secondary_send_buffer_positions(), nest::VPManager::get_thread_id(), nest::kernel(), nest::VPManager::node_id_to_lid(), send_buffer_secondary_events_, send_local_(), nest::ConnectionManager::send_to_devices(), and nest::KernelManager::vp_manager.

Referenced by nest::eprop_readout::update(), nest::eprop_readout_bsshslm_2020::update(), nest::step_rate_generator::update(), nest::rate_neuron_ipn< TNonlinearities >::update_(), nest::rate_neuron_opn< TNonlinearities >::update_(), and nest::rate_transformer_node< TNonlinearities >::update_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_to_node()

void nest::EventDeliveryManager::send_to_node ( Event &  e)
inline

Send event e directly to its target node.

This should be used only where necessary, e.g. if a node wants to reply to a *RequestEvent immediately.

◆ set_complete_marker_target_data_()

void nest::EventDeliveryManager::set_complete_marker_target_data_ ( const AssignedRanks &  assigned_ranks,
const TargetSendBufferPosition &  send_buffer_position 
)
private

Sets marker in MPI buffer that signals end of communication across MPI ranks.

References nest::AssignedRanks::begin, nest::TargetSendBufferPosition::end(), nest::AssignedRanks::end, and send_buffer_target_data_.

Referenced by gather_target_data(), and gather_target_data_compressed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_end_marker_()

template<typename SpikeDataT >
void nest::EventDeliveryManager::set_end_marker_ ( const SendBufferPosition &  send_buffer_position,
std::vector< SpikeDataT > &  send_buffer,
size_t  local_max_spikes_per_rank 
)
private

Set end marker for per-rank-chunks signalling completion and providing shrink/grow information.

References nest::SendBufferPosition::begin(), nest::SendBufferPosition::end(), nest::MPIManager::get_num_processes(), nest::MPIManager::get_send_recv_count_spike_data_per_rank(), nest::SendBufferPosition::idx(), nest::kernel(), and nest::KernelManager::mpi_manager.

Referenced by gather_spike_data_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_off_grid_communication()

void nest::EventDeliveryManager::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::NodeManager::add_node(), and nest::spike_train_injector::pre_run_hook().

Here is the caller graph for this function:

◆ set_status()

void nest::EventDeliveryManager::set_status ( const Dictionary &  )
overridevirtual

Set the status of the manager.

See also
get_status()

Implements nest::ManagerInterface.

References nest::names::off_grid_spiking(), off_grid_spiking_, send_recv_buffer_grow_extra_, send_recv_buffer_shrink_limit_, send_recv_buffer_shrink_spare_, nest::names::spike_buffer_grow_extra(), nest::names::spike_buffer_shrink_limit(), nest::names::spike_buffer_shrink_spare(), and Dictionary::update_value().

Here is the call graph for this function:

◆ update_moduli()

void nest::EventDeliveryManager::update_moduli ( )

Update modulo table based on current time settings.

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.

Update table of fixed modulos, including slice-based.

References nest::KernelManager::connection_manager, nest::SimulationManager::get_clock(), nest::ConnectionManager::get_max_delay(), nest::ConnectionManager::get_min_delay(), nest::Time::get_steps(), nest::kernel(), moduli_, nest::KernelManager::simulation_manager, and slice_moduli_.

Referenced by nest::SimulationManager::advance_time_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_done_marker_secondary_events_()

void nest::EventDeliveryManager::write_done_marker_secondary_events_ ( const bool  done)

References nest::MPIManager::get_done_marker_position_in_secondary_events_send_buffer(), nest::MPIManager::get_num_processes(), nest::kernel(), nest::KernelManager::mpi_manager, and send_buffer_secondary_events_.

Referenced by gather_secondary_events().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_toggle()

size_t nest::EventDeliveryManager::write_toggle ( ) const
inline

Return 0 for even, 1 for odd time slices.

This is useful for buffers that need to be written alternatingly by time slice. The value is given by get_slice_() % 2.

See also
read_toggle

References nest::SimulationManager::get_slice(), nest::kernel(), and nest::KernelManager::simulation_manager.

Referenced by read_toggle().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ buffer_size_target_data_has_changed_

bool nest::EventDeliveryManager::buffer_size_target_data_has_changed_
private

whether size of MPI buffer for communication of connections was changed

Referenced by gather_target_data(), gather_target_data_compressed(), and initialize().

◆ emitted_spikes_register_

std::vector< std::vector< SpikeDataWithRank >* > nest::EventDeliveryManager::emitted_spikes_register_
private

Register of emitted spikes.

All spikes to be delivered non-locally are first written to this register by the thread generating the spike. They are later transferred to communication buffers and exchanged globally.

The outer dimension represents the thread generating the spikes, the second dimension the individual spikes.

Note
We store here pointers to the vectors for the individual threads so that those vectors, including their administrative metadata will be stored in thread-local memory.

Referenced by finalize(), gather_spike_data_(), initialize(), reset_spike_register_(), and send_remote().

◆ gather_completed_checker_

PerThreadBoolIndicator nest::EventDeliveryManager::gather_completed_checker_
private

◆ global_max_spikes_per_rank_

size_t nest::EventDeliveryManager::global_max_spikes_per_rank_
private

Largest number of spikes sent from any rank to any other rank in last spike exchange round.

The spike buffer section for any rank must be at least this size. Therefore, this number controls buffer resizing.

Referenced by gather_spike_data_().

◆ local_spike_counter_

std::vector< unsigned long > nest::EventDeliveryManager::local_spike_counter_
private

Number of generated spike events (both off- and on-grid) during the last call to simulate.

Referenced by get_status(), initialize(), reset_counters(), and send().

◆ moduli_

std::vector< long > nest::EventDeliveryManager::moduli_
private

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(), init_moduli(), and update_moduli().

◆ off_grid_emitted_spikes_register_

std::vector< std::vector< OffGridSpikeDataWithRank >* > nest::EventDeliveryManager::off_grid_emitted_spikes_register_
private

Register of emitted off-grid spikes.

All off-grid spikes to be delivered non-locally are first written to this register by the thread generating the spike. They are later transferred to communication buffers and exchanged globally.

The outer dimension represents the thread generating the spikes, the second dimension the individual spikes.

Note
We store here pointers to the vectors for the individual threads so that those vectors, including their administrative metadata will be stored in thread-local memory.

Referenced by finalize(), gather_spike_data_(), initialize(), reset_spike_register_(), and send_off_grid_remote().

◆ off_grid_spiking_

bool nest::EventDeliveryManager::off_grid_spiking_
private

◆ recv_buffer_off_grid_spike_data_

std::vector< OffGridSpikeData > nest::EventDeliveryManager::recv_buffer_off_grid_spike_data_
private

◆ recv_buffer_secondary_events_

std::vector< unsigned int > nest::EventDeliveryManager::recv_buffer_secondary_events_
private

◆ recv_buffer_spike_data_

std::vector< SpikeData > nest::EventDeliveryManager::recv_buffer_spike_data_
private

◆ recv_buffer_target_data_

std::vector< TargetData > nest::EventDeliveryManager::recv_buffer_target_data_
private

◆ send_buffer_off_grid_spike_data_

std::vector< OffGridSpikeData > nest::EventDeliveryManager::send_buffer_off_grid_spike_data_
private

◆ send_buffer_secondary_events_

std::vector< unsigned int > nest::EventDeliveryManager::send_buffer_secondary_events_
private

Buffer to collect the secondary events after serialization.

Referenced by configure_secondary_buffers(), finalize(), gather_secondary_events(), send_secondary(), and write_done_marker_secondary_events_().

◆ send_buffer_spike_data_

std::vector< SpikeData > nest::EventDeliveryManager::send_buffer_spike_data_
private

◆ send_buffer_target_data_

◆ send_recv_buffer_grow_extra_

double nest::EventDeliveryManager::send_recv_buffer_grow_extra_
private

when growing, add this fraction extra space

Referenced by gather_spike_data_(), get_status(), initialize(), and set_status().

◆ send_recv_buffer_resize_log_

BufferResizeLog nest::EventDeliveryManager::send_recv_buffer_resize_log_
private

Log all resize events.

This is maintained by the main thread, which is responsible for communication and resizing.

Referenced by gather_spike_data_(), get_status(), and initialize().

◆ send_recv_buffer_shrink_limit_

double nest::EventDeliveryManager::send_recv_buffer_shrink_limit_
private

shrink buffer only if below this limit

Referenced by gather_spike_data_(), get_status(), initialize(), and set_status().

◆ send_recv_buffer_shrink_spare_

double nest::EventDeliveryManager::send_recv_buffer_shrink_spare_
private

leave this fraction more space than minimally needed

Referenced by gather_spike_data_(), get_status(), initialize(), and set_status().

◆ slice_moduli_

std::vector< long > nest::EventDeliveryManager::slice_moduli_
private

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(), init_moduli(), and update_moduli().

◆ sw_collocate_spike_data_

Stopwatch< StopwatchGranularity::Detailed, StopwatchParallelism::MasterOnly > nest::EventDeliveryManager::sw_collocate_spike_data_
private

◆ sw_communicate_spike_data_

Stopwatch< StopwatchGranularity::Detailed, StopwatchParallelism::MasterOnly > nest::EventDeliveryManager::sw_communicate_spike_data_
private

◆ sw_communicate_target_data_


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