#include <model_manager.h>
Public Member Functions | |
| ModelManager () | |
| ~ModelManager () 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. | |
| void | calibrate (const TimeConverter &) |
| Resize the structures for the Connector objects if necessary. | |
| Node * | get_proxy_node (size_t tid, size_t node_id) |
| ConnectorModel & | get_connection_model (synindex syn_id, size_t thread_id) |
| Return pointer to protoype for given synapse id. | |
| const std::vector< ConnectorModel * > & | get_connection_models (size_t tid) |
| template<class ModelT > | |
| size_t | register_node_model (const std::string &name, std::string deprecation_info=std::string()) |
| Register a node-model prototype. | |
| 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. | |
| void | copy_model (const std::string &old_name, const std::string &new_name, const Dictionary ¶ms) |
| Copy an existing model and register it as a new model. | |
| bool | set_model_defaults (const std::string &name, const Dictionary ¶ms) |
| Set the default parameters of a model. | |
| size_t | get_node_model_id (const std::string) const |
| Model * | get_node_model (size_t) const |
| size_t | get_synapse_model_id (std::string model_name) |
| Dictionary | get_connector_defaults (synindex syn_id) const |
| void | set_connector_defaults (synindex syn_id, const Dictionary &d) |
| void | assert_valid_syn_id (synindex syn_id, size_t t) const |
| Asserts validity of synapse index, otherwise throws exception. | |
| bool | are_model_defaults_modified () const |
| size_t | get_num_connection_models () const |
| void | memory_info () const |
| Print out the memory information for each node model. | |
| std::unique_ptr< SecondaryEvent > | get_secondary_event_prototype (const synindex syn_id, const size_t tid) |
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 | |
| void | clear_node_models_ () |
| Delete all models and clear the modeldict. | |
| void | clear_connection_models_ () |
| size_t | register_node_model_ (Model *model) |
| template<typename CompleteConnecionT > | |
| void | register_specific_connection_model_ (const std::string &name) |
| void | copy_node_model_ (const size_t old_id, const std::string &new_name, const Dictionary ¶ms) |
| Copy an existing node model and register it as a new model. | |
| void | copy_connection_model_ (const size_t old_id, const std::string &new_name, const Dictionary ¶ms) |
| Copy an existing synapse model and register it as a new model. | |
| void | set_node_defaults_ (size_t model_id, const Dictionary ¶ms) |
| Set the default parameters of a model. | |
| void | set_synapse_defaults_ (size_t model_id, const Dictionary ¶ms) |
| Set the default parameters of a model. | |
| Node * | create_proxynode_ (size_t t, int model_id) |
Static Private Member Functions | |
| static bool | compare_model_by_id_ (const int a, const int b) |
| Compares model ids for sorting in memory_info. | |
Private Attributes | |
| std::vector< Model * > | node_models_ |
| List of node models. | |
| std::vector< std::vector< ConnectorModel * > > | connection_models_ |
| The list of connection models. | |
| Dictionary | modeldict_ |
| Dictionary of all node models. | |
| Dictionary | synapsedict_ |
| Dictionary of all synapse models. | |
| Model * | proxynode_model_ |
| std::vector< std::vector< Node * > > | proxy_nodes_ |
| Placeholders for remote nodes, one per thread. | |
| bool | model_defaults_modified_ |
| True if any model defaults have been modified. | |
| nest::ModelManager::ModelManager | ( | ) |
|
override |
References clear_connection_models_(), and clear_node_models_().
|
inline |
References model_defaults_modified_.
|
inline |
Asserts validity of synapse index, otherwise throws exception.
| UnknownSynapseType |
References connection_models_.
Referenced by nest::ConnectionManager::connect(), nest::ConnectionManager::connect(), get_connection_model(), get_connector_defaults(), get_secondary_event_prototype(), nest::ConnectionManager::get_synapse_status(), set_synapse_defaults_(), and nest::ConnectionManager::set_synapse_status().
| void nest::ModelManager::calibrate | ( | const TimeConverter & | tc | ) |
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.
References connection_models_, nest::kernel(), and node_models_.
Referenced by nest::SimulationManager::set_status().
|
private |
References Dictionary::clear(), connection_models_, nest::IS_PRIMARY, and synapsedict_.
Referenced by finalize(), and ~ModelManager().
|
private |
Delete all models and clear the modeldict.
This function deletes all models, which will as a side-effect also delete all nodes. The built-in models will be re-registered in initialize()
References Dictionary::clear(), model_defaults_modified_, modeldict_, node_models_, proxy_nodes_, and proxynode_model_.
Referenced by finalize(), and ~ModelManager().
|
staticprivate |
Compares model ids for sorting in memory_info.
References nest::Model::get_name(), get_node_model(), nest::kernel(), and nest::KernelManager::model_manager.
Referenced by memory_info().
|
private |
Copy an existing synapse model and register it as a new model.
| old_id | ID of existing model. |
| new_name | name of new model. |
References nest::VPManager::assert_single_threaded(), nest::KernelManager::connection_manager, connection_models_, nest::ERROR, get_connection_model(), nest::VPManager::get_thread_id(), nest::invalid_synindex, nest::kernel(), LOG, nest::MAX_SYN_ID, nest::ConnectionManager::resize_connections(), set_synapse_defaults_(), synapsedict_, and nest::KernelManager::vp_manager.
Referenced by copy_model().
| void nest::ModelManager::copy_model | ( | const std::string & | old_name, |
| const std::string & | new_name, | ||
| const Dictionary & | params | ||
| ) |
Copy an existing model and register it as a new model.
This function allows users to create their own, cloned models.
| old_name | name of existing model. |
| new_name | name of new model. |
| params | default parameters of new model. |
References copy_connection_model_(), copy_node_model_(), Dictionary::get(), Dictionary::known(), modeldict_, and synapsedict_.
Referenced by nest::copy_model().
|
private |
Copy an existing node model and register it as a new model.
| old_id | ID of existing model. |
| new_name | name of new model. |
References nest::Model::clone(), create_proxynode_(), nest::Model::deprecation_warning(), get_node_model(), nest::VPManager::get_thread_id(), nest::kernel(), modeldict_, node_models_, proxy_nodes_, nest::Model::set_model_id(), set_node_defaults_(), and nest::KernelManager::vp_manager.
Referenced by copy_model().
|
private |
References nest::Model::create(), proxynode_model_, and nest::Node::set_model_id().
Referenced by copy_node_model_(), and register_node_model_().
|
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.
| 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. |
Implements nest::ManagerInterface.
References clear_connection_models_(), and clear_node_models_().
|
inline |
Return pointer to protoype for given synapse id.
| UnknownSynapseType |
References assert_valid_syn_id(), and connection_models_.
Referenced by nest::TargetTableDevices::add_connection_from_device(), nest::TargetTableDevices::add_connection_to_device(), nest::SourceTable::compute_buffer_pos_for_unique_secondary_sources(), nest::ConnectionManager::compute_compressed_secondary_recv_buffer_positions(), nest::BipartiteConnBuilder::connect(), nest::ConnectionManager::connect_(), copy_connection_model_(), nest::ConnectionManager::deliver_secondary_events(), nest::ConnectionManager::fill_target_buffer(), get_secondary_event_prototype(), nest::SPManager::get_status(), nest::ConnectionManager::get_synapse_status(), nest::BipartiteConnBuilder::set_synapse_model_(), and nest::ConnectionManager::set_synapse_status().
|
inline |
References connection_models_.
Referenced by nest::EventDeliveryManager::deliver_events_(), and nest::ConnectionManager::deliver_secondary_events().
| Dictionary nest::ModelManager::get_connector_defaults | ( | synindex | syn_id | ) | const |
References assert_valid_syn_id(), nest::KernelManager::connection_manager, connection_models_, nest::names::element_type(), nest::ConnectionManager::get_num_connections(), nest::kernel(), and nest::names::num_connections().
Referenced by nest::BipartiteConnBuilder::BipartiteConnBuilder(), nest::ConnectionManager::connect_arrays(), nest::ConnectionCreator::ConnectionCreator(), nest::ConnectionCreator::extract_params_(), nest::get_model_defaults(), nest::BipartiteConnBuilder::set_default_weight_or_delay_(), and nest::SPBuilder::update_delay().
|
inline |
References node_models_.
Referenced by nest::NodeManager::add_node(), compare_model_by_id_(), copy_node_model_(), nest::Node::get_model_(), nest::get_model_defaults(), nest::ModelRangeManager::get_model_of_node_id(), nest::Node::get_name(), nest::Model::get_status(), nest::proxynode::get_status(), nest::NodeCollectionPrimitive::NodeCollectionPrimitive(), nest::NodeManager::print(), nest::NodeCollectionComposite::print_me(), nest::NodeCollectionPrimitive::print_primitive(), nest::proxynode::send_test_event(), nest::proxynode::sends_secondary_event(), nest::proxynode::sends_secondary_event(), nest::proxynode::sends_secondary_event(), nest::proxynode::sends_secondary_event(), nest::proxynode::sends_secondary_event(), nest::proxynode::sends_secondary_event(), nest::proxynode::sends_signal(), and set_node_defaults_().
| size_t nest::ModelManager::get_node_model_id | ( | const std::string | model_name | ) | const |
| UnknownModelName | if the model is not available |
References Dictionary::get(), Dictionary::known(), and modeldict_.
Referenced by nest::create(), nest::AbstractLayer::create_layer(), nest::get_model_defaults(), nest::eprop_readout::handles_test_event(), and nest::eprop_readout_bsshslm_2020::handles_test_event().
| size_t nest::ModelManager::get_num_connection_models | ( | ) | const |
References connection_models_, and nest::kernel().
Referenced by nest::SourceTable::fill_compressed_spike_data(), nest::ConnectionManager::get_connections(), nest::ConnectionManager::initialize(), register_specific_connection_model_(), and nest::SourceTable::resize_compressible_sources().
|
inline |
References nest::ModelRangeManager::get_model_id(), nest::kernel(), nest::KernelManager::modelrange_manager, proxy_nodes_, nest::Node::set_node_id_(), and nest::Node::set_vp().
Referenced by nest::NodeManager::get_mpi_local_node_or_device_head(), nest::NodeManager::get_node_or_proxy(), and nest::NodeManager::get_node_or_proxy().
|
inline |
References assert_valid_syn_id(), get_connection_model(), and nest::ConnectorModel::get_secondary_event().
Referenced by nest::SourceTable::compute_buffer_pos_for_unique_secondary_sources(), and nest::ConnectionManager::deliver_secondary_events().
|
overridevirtual |
Retrieve the status of the manager.
Implements nest::ManagerInterface.
References nest::names::max_num_syn_models(), nest::MAX_SYN_ID, modeldict_, nest::names::node_models(), nest::names::synapse_models(), and synapsedict_.
| size_t nest::ModelManager::get_synapse_model_id | ( | std::string | model_name | ) |
| UnknownSynapseType | if the model is not available |
References Dictionary::get(), Dictionary::known(), and synapsedict_.
Referenced by nest::ConnectionManager::connect_arrays(), nest::ConnectionCreator::ConnectionCreator(), nest::SPManager::disconnect(), nest::ConnectionCreator::extract_params_(), nest::ConnectionManager::get_connections(), nest::get_model_defaults(), nest::GenericConnectorModel< ConnectionT >::get_status(), and nest::BipartiteConnBuilder::set_synapse_model_().
|
overridevirtual |
Prepare manager for operation.
After this method has completed, the manager should be completely initialized and "ready for action".
| 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. |
Implements nest::ManagerInterface.
References connection_models_, nest::VPManager::get_num_threads(), nest::kernel(), proxy_nodes_, proxynode_model_, nest::register_models(), nest::Model::set_threads(), nest::Model::set_type_id(), and nest::KernelManager::vp_manager.
| void nest::ModelManager::memory_info | ( | ) | const |
Print out the memory information for each node model.
References compare_model_by_id_(), nest::Model::get_name(), nest::mod(), and node_models_.
| void nest::ModelManager::register_connection_model | ( | const std::string & | name | ) |
Register a synape model with a custom Connector model and without any common properties.
"hpc synapses" use TargetIdentifierIndex for ConnectionT and 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 >
| name | The name under which the ConnectorModel will be registered. |
References nest::ConnectorModel::has_property(), nest::SUPPORTS_HPC, and nest::SUPPORTS_LBL.
Referenced by nest::register_connection_model().
| size_t nest::ModelManager::register_node_model | ( | const std::string & | 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.
| name | of the new node model. |
| deprecation_info | If non-empty string, deprecation warning will be issued for model with this info to user. |
References Dictionary::known(), modeldict_, and register_node_model_().
Referenced by nest::register_node_model().
|
private |
References create_proxynode_(), nest::VPManager::get_thread_id(), nest::kernel(), modeldict_, node_models_, proxy_nodes_, and nest::KernelManager::vp_manager.
Referenced by register_node_model().
|
private |
References nest::VPManager::assert_single_threaded(), nest::KernelManager::connection_manager, connection_models_, nest::ERROR, get_num_connection_models(), nest::ConnectorModel::get_secondary_event(), nest::ConnectorModel::has_property(), nest::invalid_synindex, nest::IS_PRIMARY, nest::kernel(), Dictionary::known(), LOG, nest::MAX_SYN_ID, nest::ConnectionManager::resize_connections(), nest::ConnectorModel::set_syn_id(), synapsedict_, and nest::KernelManager::vp_manager.
| void nest::ModelManager::set_connector_defaults | ( | synindex | syn_id, |
| const Dictionary & | d | ||
| ) |
| bool nest::ModelManager::set_model_defaults | ( | const std::string & | name, |
| const Dictionary & | params | ||
| ) |
Set the default parameters of a model.
| name | of model. |
| params | default parameters to be set. |
References Dictionary::get(), Dictionary::known(), modeldict_, set_node_defaults_(), set_synapse_defaults_(), and synapsedict_.
|
private |
Set the default parameters of a model.
| model_id | of model. |
| params | default parameters to be set. |
References get_node_model(), model_defaults_modified_, and nest::Model::set_status().
Referenced by copy_node_model_(), and set_model_defaults().
|
overridevirtual |
|
private |
Set the default parameters of a model.
| name | of model. |
| params | default parameters to be set. |
References assert_valid_syn_id(), connection_models_, nest::VPManager::get_thread_id(), nest::kernel(), model_defaults_modified_, and nest::KernelManager::vp_manager.
Referenced by copy_connection_model_(), and set_model_defaults().
|
private |
The list of connection models.
This list contains all built-in connection models requested for compilation using -Dwith-models or -Dwith-modelset, models registered from within extension modules, and models created by calls to CopyModel().
The first dimension is thread-optimitzed by containing one vector with all models per thread, as to avoid colliding memory accesses during connection creation.
This list is cleared and built-in models are re-registered upon calls to ResetKernel, while those registered from user-modules and copies are not.
The elements of this list are used to create instances and are responsible for the storage of model defaults.
Referenced by assert_valid_syn_id(), calibrate(), clear_connection_models_(), copy_connection_model_(), get_connection_model(), get_connection_models(), get_connector_defaults(), get_num_connection_models(), initialize(), register_specific_connection_model_(), and set_synapse_defaults_().
|
private |
True if any model defaults have been modified.
Referenced by are_model_defaults_modified(), clear_node_models_(), set_node_defaults_(), and set_synapse_defaults_().
|
private |
Dictionary of all node models.
Referenced by clear_node_models_(), copy_model(), copy_node_model_(), get_node_model_id(), get_status(), register_node_model(), register_node_model_(), and set_model_defaults().
|
private |
List of node models.
The list contains all built-in node models requested for compilation using -Dwith-models or -Dwith-modelset, models registered from within extension modules, and models created by calls to CopyModel().
ResetKernel() clears this list and rebuilds it with built-in models only.
The elements of this list are used to create instances and are responsible for the storage of model defaults.
Referenced by calibrate(), clear_node_models_(), copy_node_model_(), get_node_model(), memory_info(), and register_node_model_().
|
private |
Placeholders for remote nodes, one per thread.
Referenced by clear_node_models_(), copy_node_model_(), get_proxy_node(), initialize(), and register_node_model_().
|
private |
Referenced by clear_node_models_(), create_proxynode_(), and initialize().
|
private |
Dictionary of all synapse models.
Referenced by clear_connection_models_(), copy_connection_model_(), copy_model(), get_status(), get_synapse_model_id(), register_specific_connection_model_(), and set_model_defaults().