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

A thread-safe vector to keep track of the status across threads, for example during gather operations. More...

#include <per_thread_bool_indicator.h>

Public Member Functions

 PerThreadBoolIndicator ()
 
BoolIndicatorUInt64 & operator[] (const size_t tid)
 
void set_true (const size_t tid)
 
void set_false (const size_t tid)
 
void logical_and (const size_t tid, const bool status)
 
void initialize (const size_t num_threads, const bool status)
 Resize to the given number of threads and set all elements to false.
 
bool all_false () const
 Waits for all threads and returns whether all elements are false.
 
bool all_true () const
 Waits for all threads and returns whether all elements are true.
 
bool any_false () const
 Waits for all threads and returns whether any elements are false.
 
bool any_true () const
 Waits for all threads and returns whether any elements are true.
 

Private Attributes

std::vector< BoolIndicatorUInt64 > per_thread_status_
 
int size_ { 0 }
 
std::atomic< int > are_true_ { 0 }
 Number of per-thread indicators currently true.
 

Detailed Description

A thread-safe vector to keep track of the status across threads, for example during gather operations.

Uses a vector of integers instead of a vector of bools to guarantee thread safety. See issue #1394.

Constructor & Destructor Documentation

◆ PerThreadBoolIndicator()

nest::PerThreadBoolIndicator::PerThreadBoolIndicator ( )
inline

Member Function Documentation

◆ all_false()

bool nest::PerThreadBoolIndicator::all_false ( ) const

Waits for all threads and returns whether all elements are false.

References are_true_, nest::KernelManager::get_omp_synchronization_construction_stopwatch(), nest::kernel(), nest::Stopwatch< detailed_timer, threaded_timer >::start(), and nest::Stopwatch< detailed_timer, threaded_timer >::stop().

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:

◆ all_true()

bool nest::PerThreadBoolIndicator::all_true ( ) const

Waits for all threads and returns whether all elements are true.

References are_true_, nest::KernelManager::get_omp_synchronization_construction_stopwatch(), nest::kernel(), size_, nest::Stopwatch< detailed_timer, threaded_timer >::start(), and nest::Stopwatch< detailed_timer, threaded_timer >::stop().

Referenced by nest::EventDeliveryManager::gather_target_data(), nest::EventDeliveryManager::gather_target_data_compressed(), and nest::SourceTable::is_cleared().

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

◆ any_false()

bool nest::PerThreadBoolIndicator::any_false ( ) const

Waits for all threads and returns whether any elements are false.

References are_true_, nest::KernelManager::get_omp_synchronization_construction_stopwatch(), nest::kernel(), size_, nest::Stopwatch< detailed_timer, threaded_timer >::start(), and nest::Stopwatch< detailed_timer, threaded_timer >::stop().

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:

◆ any_true()

bool nest::PerThreadBoolIndicator::any_true ( ) const

Waits for all threads and returns whether any elements are true.

References are_true_, nest::KernelManager::get_omp_synchronization_construction_stopwatch(), nest::kernel(), nest::Stopwatch< detailed_timer, threaded_timer >::start(), and nest::Stopwatch< detailed_timer, threaded_timer >::stop().

Here is the call graph for this function:

◆ initialize()

void nest::PerThreadBoolIndicator::initialize ( const size_t  num_threads,
const bool  status 
)

Resize to the given number of threads and set all elements to false.

References are_true_, nest::VPManager::assert_single_threaded(), nest::kernel(), per_thread_status_, size_, and nest::KernelManager::vp_manager.

Referenced by nest::SourceTable::initialize(), nest::ConnectionManager::initialize(), and nest::EventDeliveryManager::initialize().

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

◆ logical_and()

void nest::PerThreadBoolIndicator::logical_and ( const size_t  tid,
const bool  status 
)
inline

References are_true_, and per_thread_status_.

Referenced by nest::EventDeliveryManager::gather_target_data(), and nest::EventDeliveryManager::gather_target_data_compressed().

Here is the caller graph for this function:

◆ operator[]()

BoolIndicatorUInt64 & nest::PerThreadBoolIndicator::operator[] ( const size_t  tid)

References per_thread_status_.

◆ set_false()

void nest::PerThreadBoolIndicator::set_false ( const size_t  tid)
inline

References are_true_, and per_thread_status_.

Referenced by nest::EventDeliveryManager::gather_target_data(), nest::EventDeliveryManager::gather_target_data_compressed(), and nest::SourceTable::restore_entry_point().

Here is the caller graph for this function:

◆ set_true()

void nest::PerThreadBoolIndicator::set_true ( const size_t  tid)
inline

References are_true_, and per_thread_status_.

Referenced by nest::SourceTable::clear(), nest::ConnectionManager::connect_(), nest::EventDeliveryManager::gather_target_data(), nest::EventDeliveryManager::gather_target_data_compressed(), and nest::SourceTable::save_entry_point().

Here is the caller graph for this function:

Member Data Documentation

◆ are_true_

std::atomic< int > nest::PerThreadBoolIndicator::are_true_ { 0 }
private

Number of per-thread indicators currently true.

are_true_ == 0 -> all are false are_true_ == size_ -> all are true 0 < are_true_ < size_ -> some true, some false

Referenced by all_false(), all_true(), any_false(), any_true(), initialize(), logical_and(), set_false(), and set_true().

◆ per_thread_status_

std::vector< BoolIndicatorUInt64 > nest::PerThreadBoolIndicator::per_thread_status_
private

◆ size_

int nest::PerThreadBoolIndicator::size_ { 0 }
private

Referenced by all_true(), any_false(), and initialize().


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