NEST main@caf0ae8
 
Loading...
Searching...
No Matches
nest::VPManager Class Reference

#include <vp_manager.h>

Inheritance diagram for nest::VPManager:
[legend]
Collaboration diagram for nest::VPManager:
[legend]

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.
 

Constructor & Destructor Documentation

◆ VPManager()

nest::VPManager::VPManager ( )

◆ ~VPManager()

nest::VPManager::~VPManager ( )
inlineoverride

Member Function Documentation

◆ assert_single_threaded()

◆ assert_thread_parallel()

◆ finalize()

void nest::VPManager::finalize ( const bool  adjust_number_of_threads_or_rng_only)
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.

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_onlyPass true if calling from kernel_manager::change_number_of_threads() to limit operations to those necessary for thread adjustment.
See also
initialize()

Implements nest::ManagerInterface.

◆ get_assigned_ranks()

AssignedRanks nest::VPManager::get_assigned_ranks ( const size_t  tid)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_end_rank_per_thread()

size_t nest::VPManager::get_end_rank_per_thread ( const size_t  rank_start,
const size_t  num_assigned_ranks_per_thread 
) const
inline

References nest::kernel().

Referenced by get_assigned_ranks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_num_assigned_ranks_per_thread()

size_t nest::VPManager::get_num_assigned_ranks_per_thread ( ) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_num_threads()

size_t nest::VPManager::get_num_threads ( ) const
inline

◆ get_num_virtual_processes()

size_t nest::VPManager::get_num_virtual_processes ( ) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_OMP_NUM_THREADS()

size_t nest::VPManager::get_OMP_NUM_THREADS ( ) const

Get OMP_NUM_THREADS environment variable.

Note
Returns 0 if OMP_NUM_THREADS is not set.

Referenced by initialize(), and set_status().

Here is the caller graph for this function:

◆ get_start_rank_per_thread()

size_t nest::VPManager::get_start_rank_per_thread ( const size_t  tid) const
inline

References get_num_assigned_ranks_per_thread().

Referenced by get_assigned_ranks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_status()

void nest::VPManager::get_status ( Dictionary &  )
overridevirtual

Retrieve the status of the manager.

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().
See also
set_status()

Implements nest::ManagerInterface.

References get_num_threads(), get_num_virtual_processes(), nest::names::local_num_threads(), and nest::names::total_num_virtual_procs().

Here is the call graph for this function:

◆ get_thread_id()

size_t nest::VPManager::get_thread_id ( ) const
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().

◆ get_vp()

size_t nest::VPManager::get_vp ( ) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize()

void nest::VPManager::initialize ( const bool  adjust_number_of_threads_or_rng_only)
overridevirtual

Prepare manager for operation.

After this method has completed, the manager should be completely initialized and "ready for action".

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_onlyPass 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.
See also
finalize()

Implements nest::ManagerInterface.

References get_OMP_NUM_THREADS(), nest::INFO, LOG, and set_num_threads().

Here is the call graph for this function:

◆ is_local_vp()

bool nest::VPManager::is_local_vp ( const size_t  tid) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_node_id_vp_local()

bool nest::VPManager::is_node_id_vp_local ( const size_t  node_id) const
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_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lid_to_node_id()

size_t nest::VPManager::lid_to_node_id ( const size_t  lid) const
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_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_id_to_lid()

size_t nest::VPManager::node_id_to_lid ( const size_t  node_id) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_id_to_vp()

size_t nest::VPManager::node_id_to_vp ( const size_t  node_id) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_num_threads()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_status()

void nest::VPManager::set_status ( const Dictionary &  )
overridevirtual

Set the status of the manager.

See also
get_status()

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.

Here is the call graph for this function:

◆ thread_to_vp()

size_t nest::VPManager::thread_to_vp ( const size_t  tid) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vp_to_thread()

size_t nest::VPManager::vp_to_thread ( const size_t  vp) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ force_singlethreading_

const bool nest::VPManager::force_singlethreading_
private

Referenced by set_status().

◆ n_threads_

size_t nest::VPManager::n_threads_
private

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