Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
spore::ConnectionUpdateManager Class Reference

Class that manages updating diligent connections. More...

#include <connection_updater.h>

Public Member Functions

 ConnectionUpdateManager ()
 
 ~ConnectionUpdateManager ()
 
void init (nest::index cu_model_id)
 
void setup (long interval, long exceptable_latency)
 Sets up the ConnectionUpdateManager with the given update interval and acceptable latency. More...
 
void register_connector (nest::ConnectorBase *new_conn, nest::ConnectorBase *old_conn, nest::index sender_gid, nest::thread th, nest::synindex syn_id)
 
void trigger_garbage_collector (nest::index target_gid, nest::index sender_gid, nest::thread target_thread, nest::synindex syn_id)
 
nest::delay get_interval () const
 
nest::delay get_acceptable_latency () const
 
nest::delay get_max_latency () const
 
nest::Time get_origin () const
 
nest::Time get_horizon () const
 
bool is_valid () const
 
bool has_connections () const
 
bool is_initialized () const
 

Static Public Member Functions

static ConnectionUpdateManagerinstance ()
 

Friends

class ConnectionUpdater
 

Detailed Description

Class that manages updating diligent connections.

Singleton class that manages updating connections that require regular updates (diligent connections). The object is supposed to be updated in a regular interval (defined by get_interval()). Synapses that were not updated for longer than specified by get_acceptable_latency() will by updated. The maximum update latency that may occur can be retrieved through the get_max_latency() method.

Synapses that use the functionality of the update manager should be registered using the register_connector() method. Synapse Models that are instantiated using the DiligentConnectorModel do this automatically.

Initializing the Update Manager

If diligent connections are used the SLI function InitSynapseUpdater must be called before the first call to Connect. This is done automatically when the SPORE module is loaded but must be done manually after the NEST kernel has been reset using ResetKernel or its state has changed using SetKernelStatus. Therefore a line of code

<update_interval> <acceptable_latency> InitSynapseUpdater

is required, where <update_interval> is an integer value (default: 100) that defines the interval (in number of nest time steps) of invoking the update manager and <acceptable_latency> is an integer value (default: 100) defining the acceptable latency for synapses. These parameters can be used to optimize the simulation performance. Long update intervals are likely more time efficient, but require more memory. Equivalently, if using python, add a line

nest.sli_func('InitSynapseUpdater',<update_interval>,<acceptable_latency>)

after each call to ResetKernel / SetKernelStatus. InitSynapseUpdater may be called multiple times to change the parameters of the update manager, but must not be invoked again after the first call to Simulate (see: setup()).

Garbage Collection

ConnectionUpdateManager also provides a mechanism to removed synapses that become nonfunctional (garbage collection). The synapse must take care of invoking the garbage collector by calling the trigger_garbage_collector() method. After a call to this the synapse must return true in its is_degenerated method. The synapse is not deleted immediately. If trigger_garbage_collector() was triggered from within the send function of the synapse the function is guaranteed to be finished before the synapse is removed. The send function may also be triggered again multiple times after a call to trigger_garbage_collector() before the synapse is finally removed. The synapse should in that case not call trigger_garbage_collector() again or change its behavior of returning true from is_degenerated, as this would lead to undefined behavior.

The garbage collection feature should not be used together with structural plasticity mechanisms of NEST which delete synapses of the same synapse type, since these may interfere with the garbage collector. Using structural plasticity mechanisms which only add synapses is however possible.

See also
DiligentConnectorModel, SporeModule::InitSynapseUpdater_i_i_Function

Constructor & Destructor Documentation

◆ ConnectionUpdateManager()

spore::ConnectionUpdateManager::ConnectionUpdateManager ( )

Constructor.

◆ ~ConnectionUpdateManager()

spore::ConnectionUpdateManager::~ConnectionUpdateManager ( )

Destructor.

Member Function Documentation

◆ get_acceptable_latency()

nest::delay spore::ConnectionUpdateManager::get_acceptable_latency ( ) const
inline
Returns
the maximum allowed delay.

◆ get_horizon()

nest::Time spore::ConnectionUpdateManager::get_horizon ( ) const
inline
Returns
the time limit up to which connections should be updated.

◆ get_interval()

nest::delay spore::ConnectionUpdateManager::get_interval ( ) const
inline
Returns
the update interval.

◆ get_max_latency()

nest::delay spore::ConnectionUpdateManager::get_max_latency ( ) const
inline
Returns
the maximum latency of any registered connection.

◆ get_origin()

nest::Time spore::ConnectionUpdateManager::get_origin ( ) const
inline
Returns
the time limit up to which connections should be updated.

◆ has_connections()

bool spore::ConnectionUpdateManager::has_connections ( ) const
inline
Returns
true if at least one connection has been registered.

◆ init()

void spore::ConnectionUpdateManager::init ( nest::index  cu_model_id)

Initializes the connection update manager. This must be called once at start up and should be done within the initialization of the module that uses the ConnectionUpdateManager.

◆ instance()

ConnectionUpdateManager * spore::ConnectionUpdateManager::instance ( )
static
Returns
the only instance of ConnectionUpdateManager.

◆ is_initialized()

bool spore::ConnectionUpdateManager::is_initialized ( ) const
inline
Returns
true if the connection manager is initialized and ready for the simulation.

◆ is_valid()

bool spore::ConnectionUpdateManager::is_valid ( ) const
inline
Returns
true if the ConnectionUpdateManager is set up correctly.

◆ register_connector()

void spore::ConnectionUpdateManager::register_connector ( nest::ConnectorBase *  new_conn,
nest::ConnectorBase *  old_conn,
nest::index  sender_gid,
nest::thread  th,
nest::synindex  syn_id 
)

Adds the given connector and removes the old one. New connector can be 0; in that case only the old one is removed. The old connector can be 0; in that case only the new one is added. If new_conn is not 0 it must be a homogeneous connector model.

Parameters

◆ setup()

void spore::ConnectionUpdateManager::setup ( long  interval,
long  acceptable_latency 
)

Sets up the ConnectionUpdateManager with the given update interval and acceptable latency.

This function must be called once before the first call to Connect after the NEST kernel was reset or its status has changed. This function is invoked by the InitSynapseUpdater SLI function.

Parameters
intervalthe update interval used to update connections.
acceptable_latencythe maximum acceptable latency allowed for a connection.
Note
This function may not be thread safe.

◆ trigger_garbage_collector()

void spore::ConnectionUpdateManager::trigger_garbage_collector ( nest::index  target_gid,
nest::index  sender_gid,
nest::thread  target_thread,
nest::synindex  syn_id 
)

Trigger garbage collector for given connection.


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