#include <vp_manager.h>
Public Member Functions | |
| VPManager () | |
| ~VPManager () override | |
| void | initialize (const bool) override |
| Prepare manager for operation. | |
| void | finalize (const bool) override |
| Take down manager after operation. | |
| virtual void | set_status (const Dictionary &) override |
| Set the status of the manager. | |
| virtual void | get_status (Dictionary &) override |
| Retrieve the status of the manager. | |
| size_t | get_thread_id () const |
| Gets ID of local thread. | |
| void | set_num_threads (const size_t n_threads) |
| Set the number of threads by setting the internal variable n_threads_, the corresponding value in the Communicator, and the OpenMP number of threads. | |
| size_t | get_num_threads () const |
| Get number of threads. | |
| size_t | get_OMP_NUM_THREADS () const |
| Get OMP_NUM_THREADS environment variable. | |
| bool | is_node_id_vp_local (const size_t node_id) const |
| Returns true if the given global node exists on this vp. | |
| size_t | node_id_to_lid (const size_t node_id) const |
| Returns thread local index of a given global node. | |
| size_t | lid_to_node_id (const size_t lid) const |
| Returns the node ID of a given local index. | |
| size_t | get_vp () const |
| Returns virtual process index. | |
| size_t | node_id_to_vp (const size_t node_id) const |
| Return a thread number for a given global node id. | |
| size_t | vp_to_thread (const size_t vp) const |
| Convert a given VP ID to the corresponding thread ID. | |
| size_t | thread_to_vp (const size_t tid) const |
| Convert a given thread ID to the corresponding VP ID. | |
| bool | is_local_vp (const size_t tid) const |
| Return true, if the given VP is on the local machine. | |
| size_t | get_num_virtual_processes () const |
| Returns the number of virtual processes. | |
| void | assert_single_threaded () const |
| Fails if NEST is in thread-parallel section. | |
| void | assert_thread_parallel () const |
| Fails if NEST is not in thread-parallel section. | |
| size_t | get_num_assigned_ranks_per_thread () const |
| Returns the number of processes that are taken care of by a single thread while processing MPI buffers in a multithreaded environment. | |
| size_t | get_start_rank_per_thread (const size_t tid) const |
| size_t | get_end_rank_per_thread (const size_t rank_start, const size_t num_assigned_ranks_per_thread) const |
| AssignedRanks | get_assigned_ranks (const size_t tid) |
| Returns assigned ranks per thread to fill MPI buffers. | |
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 Attributes | |
| const bool | force_singlethreading_ |
| size_t | n_threads_ |
| Number of threads per process. | |
| nest::VPManager::VPManager | ( | ) |
|
inlineoverride |
|
inline |
Fails if NEST is in thread-parallel section.
Referenced by dictionary_::all_entries_accessed(), nest::ThirdInBuilder::connect_(), nest::ModelManager::copy_connection_model_(), nest::Stopwatch< detailed_timer, threaded_timer >::get_status(), dictionary_::init_access_flags(), nest::PerThreadBoolIndicator::initialize(), nest::ModelManager::register_specific_connection_model_(), nest::Stopwatch< detailed_timer, threaded_timer >::reset(), nest::DataSecondaryEvent< DataType, Subclass >::set_coeff_length(), and nest::NodeManager::update_thread_local_node_data().
|
inline |
Fails if NEST is not in thread-parallel section.
References n_threads_.
Referenced by nest::DataSecondaryEvent< DataType, Subclass >::add_syn_id(), nest::Stopwatch< detailed_timer, threaded_timer >::elapsed(), nest::Stopwatch< detailed_timer, threaded_timer >::is_running_(), nest::Stopwatch< detailed_timer, threaded_timer >::print(), nest::ConnectionManager::resize_connections(), nest::SourceTable::resize_sources(), nest::TargetTableDevices::resize_to_number_of_synapse_types(), nest::Stopwatch< detailed_timer, threaded_timer >::start(), and nest::Stopwatch< detailed_timer, threaded_timer >::stop().
|
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.
|
inline |
Returns assigned ranks per thread to fill MPI buffers.
Thread tid is responsible for all ranks in [assigned_ranks.begin, assigned_ranks.end), which are in total assigned_ranks.size and at most assigned_ranks.max_size
References nest::AssignedRanks::begin, nest::AssignedRanks::end, get_end_rank_per_thread(), get_num_assigned_ranks_per_thread(), get_start_rank_per_thread(), nest::AssignedRanks::max_size, and nest::AssignedRanks::size.
Referenced by nest::EventDeliveryManager::gather_target_data(), and nest::EventDeliveryManager::gather_target_data_compressed().
|
inline |
References nest::kernel().
Referenced by get_assigned_ranks().
|
inline |
Returns the number of processes that are taken care of by a single thread while processing MPI buffers in a multithreaded environment.
References nest::kernel(), and n_threads_.
Referenced by get_assigned_ranks(), and get_start_rank_per_thread().
|
inline |
Get number of threads.
This function returns the total number of threads per process.
References n_threads_.
Referenced by nest::ConnectionManager::calibrate(), nest::SimulationManager::call_update_(), nest::RandomManager::check_rng_synchrony(), nest::ConnectionManager::compute_target_data_buffer_size(), nest::ConnectionManager::connect_arrays(), nest::SPManager::disconnect(), nest::SourceTable::fill_compressed_spike_data(), nest::SourceTable::find_maximal_position(), get_num_virtual_processes(), nest::ConnectionManager::get_sources(), get_status(), nest::SPManager::get_synaptic_elements(), nest::ConnectionManager::get_targets(), nest::NodeManager::get_thread_siblings(), nest::SourceTable::initialize(), nest::TargetTable::initialize(), nest::TargetTableDevices::initialize(), nest::RecordingBackendMPI::initialize(), nest::StimulationBackendMPI::initialize(), nest::ConnectionManager::initialize(), nest::EventDeliveryManager::initialize(), nest::ModelManager::initialize(), nest::RandomManager::initialize(), nest::ConnectionManager::initialize_iteration_state(), nest::StimulationBackendMPI::prepare(), nest::Stopwatch< detailed_timer, threaded_timer >::reset(), set_status(), nest::NodeManager::set_status(), nest::BipartiteConnBuilder::set_synapse_params(), and nest::NodeManager::update_thread_local_node_data().
|
inline |
Returns the number of virtual processes.
References nest::MPIManager::get_num_processes(), get_num_threads(), nest::kernel(), and nest::KernelManager::mpi_manager.
Referenced by nest::SparseNodeArray::add_local_node(), nest::NodeManager::add_neurons_(), nest::nc_const_iterator::advance_local_iter_to_new_part_(), nest::RecordingBackendASCII::compute_vp_node_id_string_(), nest::FixedTotalNumberBuilder::connect_(), get_status(), is_node_id_vp_local(), lid_to_node_id(), node_id_to_lid(), node_id_to_vp(), set_status(), nest::NodeCollectionPrimitive::thread_local_begin(), and nest::NodeCollectionComposite::thread_local_begin().
| size_t nest::VPManager::get_OMP_NUM_THREADS | ( | ) | const |
Get OMP_NUM_THREADS environment variable.
Referenced by initialize(), and set_status().
|
inline |
References get_num_assigned_ranks_per_thread().
Referenced by get_assigned_ranks().
|
overridevirtual |
Retrieve the status of the manager.
Implements nest::ManagerInterface.
References get_num_threads(), get_num_virtual_processes(), nest::names::local_num_threads(), and nest::names::total_num_virtual_procs().
|
inline |
Gets ID of local thread.
Returns thread ID if OpenMP is installed and zero otherwise.
Referenced by nest::NodeManager::add_devices_(), nest::NodeManager::add_music_nodes_(), nest::NodeManager::add_neurons_(), nest::RecordingBackendMPI::cleanup(), nest::StimulationBackendMPI::cleanup(), nest::RecordingBackendSIONlib::close_files_(), nest::EventDeliveryManager::configure_spike_register(), nest::ConnectionManager::connect(), nest::ThirdInBuilder::connect_(), nest::OneToOneBuilder::connect_(), nest::AllToAllBuilder::connect_(), nest::FixedInDegreeBuilder::connect_(), nest::FixedOutDegreeBuilder::connect_(), nest::FixedTotalNumberBuilder::connect_(), nest::BernoulliBuilder::connect_(), nest::PoissonBuilder::connect_(), nest::SymmetricBernoulliBuilder::connect_(), nest::SPBuilder::connect_(), nest::ConnectionManager::connect_arrays(), nest::ModelManager::copy_connection_model_(), nest::ModelManager::copy_node_model_(), nest::SPManager::delete_synapse(), nest::NodeManager::destruct_nodes_(), nest::SPManager::disconnect(), nest::OneToOneBuilder::disconnect_(), nest::AllToAllBuilder::disconnect_(), nest::Stopwatch< detailed_timer, threaded_timer >::elapsed(), nest::NodeManager::finalize_nodes(), nest::ConnectionManager::get_connections(), nest::ConnectionManager::get_connections(), nest::ConnectionManager::get_delay_checker(), nest::NodeManager::get_nodes(), get_vp(), nest::SourceTable::initialize(), nest::TargetTable::initialize(), nest::ConnectionManager::initialize(), nest::EventDeliveryManager::initialize(), nest::RandomManager::initialize(), nest::Stopwatch< detailed_timer, threaded_timer >::is_running_(), nest::RecordingBackendSIONlib::open_files_(), nest::ConnectionCreator::pairwise_bernoulli_on_source_(), nest::ConnectionCreator::pairwise_bernoulli_on_target_(), nest::ConnectionCreator::pairwise_poisson_(), nest::NodeManager::post_run_cleanup(), nest::RecordingBackendSIONlib::post_step_hook(), nest::RecordingBackendMPI::prepare(), nest::SimulationManager::prepare(), nest::StimulationBackendMPI::prepare(), nest::NodeManager::prepare_nodes(), nest::Stopwatch< detailed_timer, threaded_timer >::print(), nest::ThirdInBuilder::register_connection(), nest::ModelManager::register_node_model_(), nest::TargetTableDevices::resize_to_number_of_neurons(), nest::TargetTableDevices::resize_to_number_of_synapse_types(), nest::EventDeliveryManager::send_secondary(), nest::STDPDopaCommonProperties::set_status(), nest::CommonSynapseProperties::set_status(), nest::ModelManager::set_synapse_defaults_(), nest::OneToOneBuilder::sp_connect_(), nest::AllToAllBuilder::sp_connect_(), nest::OneToOneBuilder::sp_disconnect_(), nest::AllToAllBuilder::sp_disconnect_(), nest::Stopwatch< detailed_timer, threaded_timer >::start(), nest::Stopwatch< detailed_timer, threaded_timer >::stop(), nest::ThirdBernoulliWithPoolBuilder::third_connect(), nest::ThirdBernoulliWithPoolBuilder::ThirdBernoulliWithPoolBuilder(), nest::ThirdInBuilder::ThirdInBuilder(), nest::ConnectionManager::trigger_update_weight(), nest::SimulationManager::update_(), nest::StimulationBackendMPI::update_device(), nest::NormalParameter::value(), nest::LognormalParameter::value(), nest::RecordingBackendMPI::write(), nest::ThirdBernoulliWithPoolBuilder::~ThirdBernoulliWithPoolBuilder(), and nest::ThirdInBuilder::~ThirdInBuilder().
|
inline |
Returns virtual process index.
References nest::MPIManager::get_num_processes(), nest::MPIManager::get_rank(), get_thread_id(), nest::kernel(), and nest::KernelManager::mpi_manager.
Referenced by nest::RandomManager::initialize(), is_node_id_vp_local(), and lid_to_node_id().
|
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 get_OMP_NUM_THREADS(), nest::INFO, LOG, and set_num_threads().
|
inline |
Return true, if the given VP is on the local machine.
References nest::MPIManager::get_process_id_of_vp(), nest::MPIManager::get_rank(), nest::kernel(), and nest::KernelManager::mpi_manager.
Referenced by nest::ConnectionManager::connection_required(), nest::NodeManager::is_local_node(), and nest::NodeManager::is_local_node_id().
|
inline |
Returns true if the given global node exists on this vp.
References get_num_virtual_processes(), and get_vp().
Referenced by nest::ThirdInBuilder::connect_().
|
inline |
Returns the node ID of a given local index.
References get_num_virtual_processes(), and get_vp().
Referenced by nest::TargetTableDevices::get_connections_to_device_for_lid_().
|
inline |
Returns thread local index of a given global node.
References get_num_virtual_processes().
Referenced by nest::TargetTableDevices::add_connection_to_device(), nest::ConnectionManager::fill_target_buffer(), nest::TargetTableDevices::get_connections_to_devices_(), nest::TargetTableDevices::get_synapse_status_to_device(), nest::EventDeliveryManager::send_off_grid_remote(), nest::EventDeliveryManager::send_remote(), nest::EventDeliveryManager::send_secondary(), nest::TargetTableDevices::send_to_device(), nest::TargetTableDevices::send_to_device(), and nest::TargetTableDevices::set_synapse_status_to_device().
|
inline |
Return a thread number for a given global node id.
Each node has a default thread on which it will run. The thread is defined by the relation: t = (node_id div P) mod T, where P is the number of simulation processes and T the number of threads. This may be used by Network::add_node() if the user has not specified anything.
References get_num_virtual_processes().
Referenced by nest::NodeManager::add_neurons_(), nest::FixedTotalNumberBuilder::connect_(), nest::ConnectionManager::connection_required(), nest::NodeManager::get_node_or_proxy(), nest::NodeCollectionComposite::gid_to_vp_(), nest::NodeManager::is_local_node_id(), nest::NodeCollectionPrimitive::thread_local_begin(), and nest::update_value_param().
| void nest::VPManager::set_num_threads | ( | const size_t | n_threads | ) |
Set the number of threads by setting the internal variable n_threads_, the corresponding value in the Communicator, and the OpenMP number of threads.
References nest::kernel(), and n_threads_.
Referenced by nest::KernelManager::change_number_of_threads(), and initialize().
|
overridevirtual |
Set the status of the manager.
Implements nest::ManagerInterface.
References nest::KernelManager::change_number_of_threads(), force_singlethreading_, nest::MPIManager::get_num_processes(), get_num_threads(), get_num_virtual_processes(), get_OMP_NUM_THREADS(), nest::kernel(), nest::names::local_num_threads(), LOG, nest::KernelManager::mpi_manager, nest::names::total_num_virtual_procs(), and nest::WARNING.
|
inline |
Convert a given thread ID to the corresponding VP ID.
References nest::MPIManager::get_num_processes(), nest::MPIManager::get_rank(), nest::kernel(), and nest::KernelManager::mpi_manager.
Referenced by nest::NodeManager::add_neurons_(), nest::nc_const_iterator::advance_local_iter_to_new_part_(), nest::RecordingBackendSIONlib::close_files_(), nest::FixedTotalNumberBuilder::connect_(), nest::RecordingBackendSIONlib::open_files_(), nest::RecordingBackendSIONlib::post_step_hook(), nest::NodeCollectionPrimitive::thread_local_begin(), and nest::NodeCollectionComposite::thread_local_begin().
|
inline |
Convert a given VP ID to the corresponding thread ID.
References nest::MPIManager::get_num_processes(), nest::kernel(), and nest::KernelManager::mpi_manager.
Referenced by nest::ConnectionManager::connection_required(), nest::ConnectionManager::fill_target_buffer(), nest::NodeManager::get_mpi_local_node_or_device_head(), nest::NodeManager::get_node_or_proxy(), nest::update_value_param(), nest::NormalParameter::value(), and nest::LognormalParameter::value().
|
private |
Referenced by set_status().
|
private |
Number of threads per process.
Referenced by assert_thread_parallel(), get_num_assigned_ranks_per_thread(), get_num_threads(), and set_num_threads().