Model Manager¶
The ModelManager is responsible for managing node and connection models, including their registration, copying, and configuration. It handles the initialization and finalization of models, sets default parameters, and manages memory for node models. The class also provides functionality for calibrating models and retrieving their status. The code is designed to work in a multi-threaded environment, ensuring that models are correctly managed across different threads. The ModelManager plays a crucial role in the simulation framework by providing a centralized way to handle various models and their configurations.
-
class ModelManager : public nest::ManagerInterface¶
Public Functions
-
virtual void initialize(const bool) override¶
Prepare manager for operation.
After this method has completed, the manager should be completely initialized and “ready for action”.
See also
Note
Initialization of any given manager may depend on other managers having been initialized before. KernelManager::initialize() is responsible for calling the initialization routines on the specific managers in correct order.
- Parameters:
adjust_number_of_threads_or_rng_only – Pass true if calling from kernel_manager::change_number_of_threads() or RandomManager::get_status() to limit operations to those necessary for thread adjustment or switch or re-seeding of RNG.
-
virtual void finalize(const bool) override¶
Take down manager after operation.
After this method has completed, all dynamic data structures created by the manager shall be deallocated and containers emptied. Plain variables need not be reset.
See also
Note
Finalization of any given manager may depend on other managers not having been finalized yet. KernelManager::finalize() is responsible for calling the initialization routines on the specific managers in correct order, i.e., the opposite order of initialize() calls.
- Parameters:
adjust_number_of_threads_or_rng_only – Pass true if calling from kernel_manager::change_number_of_threads() to limit operations to those necessary for thread adjustment.
-
virtual void set_status(const DictionaryDatum&) override¶
Set the status of the manager.
See also
-
virtual void get_status(DictionaryDatum&) override¶
Retrieve the status of the manager.
See also
Note
This would ideally be a const function. However, some managers delay the update of internal variables up to the point where they are needed (e.g., before reporting their values to the user, or before simulate is called). An example for this pattern is the call to update_delay_extrema_() right at the beginning of ConnectionManager::get_status().
-
void calibrate(const TimeConverter&)¶
Resize the structures for the Connector objects if necessary.
Functor to compare Models by their name.
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.
-
inline Node *get_proxy_node(size_t tid, size_t node_id)¶
Return a proxynode configured for thread tid and the given node_id.
-
inline ConnectorModel &get_connection_model(synindex syn_id, size_t thread_id)¶
Return pointer to protoype for given synapse id.
- Todo:
: make the return type const, after the increment of num_connections and the min_ and max_delay setting in ConnectorBase was moved out to the ConnectionManager
- Throws:
UnknownSynapseType –
-
template<class ModelT>
size_t register_node_model(const Name &name, std::string deprecation_info = std::string())¶ Register a node-model prototype.
This function must be called exactly once for each model class to make it known in the simulator. The natural place for a call to this function is in a *module.cpp file.
See also
- Parameters:
name – of the new node model.
deprecation_info – If non-empty string, deprecation warning will be issued for model with this info to user.
- Returns:
ID of the new model object.
-
template<template<typename targetidentifierT> class ConnectionT>
void register_connection_model(const std::string &name)¶ Register a synape model with a custom Connector model and without any common properties.
“hpc synapses” use
TargetIdentifierIndexforConnectionTand store the target neuron in form of a 2 Byte index instead of an 8 Byte pointer. This limits the number of thread local neurons to 65,536. No support for different receptor types. Otherwise identical to non-hpc version.When called, this function should be specialised by a class template, e.g.
bernoulli_synapse< targetidentifierT >- Parameters:
name – The name under which the ConnectorModel will be registered.
-
void copy_model(Name old_name, Name new_name, DictionaryDatum params)¶
Copy an existing model and register it as a new model.
This function allows users to create their own, cloned models.
See also
copy_node_model_, copy_connection_model_
- Parameters:
old_name – name of existing model.
new_name – name of new model.
params – default parameters of new model.
-
bool set_model_defaults(Name name, DictionaryDatum params)¶
Set the default parameters of a model.
See also
set_node_defaults_, set_synapse_defaults_
- Parameters:
name – of model.
params – default parameters to be set.
- Returns:
true if the operation succeeded, else false
-
size_t get_node_model_id(const Name) const¶
- Throws:
UnknownModelName – if the model is not available
- Returns:
The model ID for a Model with a given name
-
inline Model *get_node_model(size_t) const¶
- Returns:
The Model registered with the given model ID
-
size_t get_synapse_model_id(std::string model_name)¶
- Throws:
UnknownSynapseType – if the model is not available
- Returns:
The numeric ID of a given synapse model
-
inline void assert_valid_syn_id(synindex syn_id, size_t t) const¶
Asserts validity of synapse index, otherwise throws exception.
- Throws:
UnknownSynapseType –
-
void memory_info() const¶
Print out the memory information for each node model.
-
virtual void initialize(const bool) override¶