Connection Manager¶
The ConnectionManager in NEST efficiently manages synaptic connections between neurons and devices using source-table structures, supporting dynamic network modifications via structural plasticity and connection rules. It tracks connection counts, handles parallel execution resizing, and ensures disabled connections are removed to maintain network integrity.
-
class ConnectionManager : 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().
-
template<typename ConnBuilder>
void register_conn_builder(const std::string &name)¶ Add a connectivity rule, i.e.
the respective ConnBuilderFactory.
-
template<typename ThirdConnBuilder>
void register_third_conn_builder(const std::string &name)¶ Add a connectivity rule, i.e.
the respective ConnBuilderFactory.
-
BipartiteConnBuilder *get_conn_builder(const std::string &name, NodeCollectionPTR sources, NodeCollectionPTR targets, ThirdOutBuilder *third_out, const DictionaryDatum &conn_spec, const std::vector<DictionaryDatum> &syn_specs)¶
Obtain builder for bipartite connections.
-
ThirdOutBuilder *get_third_conn_builder(const std::string &name, NodeCollectionPTR sources, NodeCollectionPTR targets, ThirdInBuilder *third_in, const DictionaryDatum &conn_spec, const std::vector<DictionaryDatum> &syn_specs)¶
Obtain builder for bipartite connections.
-
void connect(NodeCollectionPTR sources, NodeCollectionPTR targets, const DictionaryDatum &conn_spec, const std::vector<DictionaryDatum> &syn_specs)¶
Create connections.
-
void connect(const size_t snode_id, Node *target, size_t target_thread, const synindex syn_id, const DictionaryDatum ¶ms, const double delay = numerics::nan, const double weight = numerics::nan)¶
Connect two nodes.
The source node is defined by its global ID. The target node is defined by the node. The connection is established on the thread/process that owns the target node.
The parameters delay and weight have the default value numerics::nan. numerics::nan is a special value, which describes double values that are not a number. If delay or weight is omitted in a connect call, numerics::nan indicates this and weight/delay are set only, if they are valid.
- Parameters:
snode_id – node ID of the sending Node.
target – Pointer to target Node.
target_thread – Thread that hosts the target node.
syn_id – The synapse model to use.
params – Parameter dictionary to configure the synapse.
delay – Delay of the connection (in ms).
weight – Weight of the connection.
-
bool connect(const size_t snode_id, const size_t target, const DictionaryDatum ¶ms, const synindex syn_id)¶
Connect two nodes.
The source and target nodes are defined by their global ID. The connection is established on the thread/process that owns the target node.
- Parameters:
snode_id – node ID of the sending Node.
target – node ID of the target Node.
params – Parameter dictionary to configure the synapse.
syn_id – The synapse model to use.
-
void connect_sonata(const DictionaryDatum &graph_specs, const long hyberslab_size)¶
Connect nodes from SONATA specification.
This function instantiates the
SonataConnectorclass and calls the class member functionconnect.- Parameters:
graph_specs – Specification dictionary, see PyNEST
SonataNetwork._create_graph_specsfor details.hyberslab_size – Size of the hyperslab to read in one read operation, applies to all HDF5 datasets.
-
void connect_tripartite(NodeCollectionPTR sources, NodeCollectionPTR targets, NodeCollectionPTR third, const DictionaryDatum &connectivity, const DictionaryDatum &third_connectivity, const std::map<Name, std::vector<DictionaryDatum>> &synapse_specs)¶
Create tripartite connections.
Note
synapse_specsis dictionary{"primary": <syn_spec>, "third_in": <syn_spec>, "third_out": <syn_spec>}; all keys are optional
-
ConnectionType connection_required(Node *&source, Node *&target, size_t tid)¶
Check whether a connection between the given source and target nodes can be established on the given thread with id tid.
- Returns:
The type of connection as ConnectionType if the connection should be made, ConnectionType::NO_CONNECTION otherwise.
-
ArrayDatum get_connections(const DictionaryDatum ¶ms)¶
Return connections between pairs of neurons.
The params dictionary can have the following entries: ‘source’ a token array with node IDs of source neurons. ‘target’ a token array with node IDs of target neuron. If either of these does not exist, all neuron are used for the respective entry. ‘synapse_model’ name of the synapse model, or all synapse models are searched. ‘synapse_label’ label (long) of the synapse, or all synapses are searched. The function then iterates all entries in source and collects the connection IDs to all neurons in target.
-
size_t get_num_connections() const¶
Returns the number of connections in the network.
-
size_t get_num_connections(const synindex syn_id) const¶
Returns the number of connections of this synapse type.
-
void trigger_update_weight(const long vt_node_id, const std::vector<spikecounter> &dopa_spikes, const double t_trig)¶
Triggered by volume transmitter in update.
Triggeres updates for all connectors of dopamine synapses that are registered with the volume transmitter with node_id vt_node_id.
-
inline long get_min_delay() const¶
Return minimal connection delay, which is precomputed by update_delay_extrema_().
-
inline long get_max_delay() const¶
Return maximal connection delay, which is precomputed by update_delay_extrema_().
-
inline void send_to_devices(const size_t tid, const size_t source_node_id, Event &e)¶
Send event e to all device targets of source source_node_id.
-
inline void send_from_device(const size_t tid, const size_t ldid, Event &e)¶
Send event e to all targets of source device ldid (local device id)
-
void send_local(size_t t, Node &source, Event &e)¶
Send event e to all targets of node source on thread t.
-
void calibrate(const TimeConverter&)¶
Resize the structures for the Connector objects if necessary.
This function should be called after number of threads, min_delay, max_delay, and time representation have been changed in the scheduler. The TimeConverter is used to convert times from the old to the new representation. It is also forwarding the calibration request to all ConnectorModel objects.
-
DelayChecker &get_delay_checker()¶
Returns the delay checker for the current thread.
-
inline void clean_source_table(const size_t tid)¶
Removes processed entries from source table.
-
inline void clear_source_table(const size_t tid)¶
Clears all entries in source table.
-
inline bool get_keep_source_table() const¶
Returns true if source table is kept after building network.
-
inline bool is_source_table_cleared() const¶
Returns true if source table was cleared.
-
inline bool use_compressed_spikes() const¶
Returns whether spikes should be compressed.
Implies that connections will be sorted by source.
-
void sort_connections(const size_t tid)¶
Sorts connections in the presynaptic infrastructure by increasing source node ID.
-
void remove_disabled_connections(const size_t tid)¶
Removes disabled connections (of structural plasticity)
-
inline bool connections_have_changed() const¶
Returns true if connection information needs to be communicated.
False otherwise.
-
void set_connections_have_changed()¶
Sets flag indicating whether connection information needs to be communicated to true.
-
void unset_connections_have_changed()¶
Sets flag indicating whether connection information needs to be communicated to false.
-
inline void restructure_connection_tables(const size_t tid)¶
Deletes TargetTable and resets processed flags of SourceTable.
This function must be called if connections are created after connections have been communicated previously. It basically restores the connection infrastructure to a state where all information only exists on the postsynaptic side.
-
inline size_t get_secondary_recv_buffer_position(const size_t tid, const synindex syn_id, const size_t lcid) const¶
Returns read position in MPI receive buffer for secondary connections.
-
void initialize_iteration_state()¶
Set iteration_state_ entries for all threads to beginning of compressed_spike_data_map_.
-
virtual void initialize(const bool) override¶