Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Eigen::ThreadPoolTempl< Environment > Class Template Reference

#include <NonBlockingThreadPool.h>

Inheritance diagram for Eigen::ThreadPoolTempl< Environment >:
Inheritance graph
[legend]

Classes

struct  PerThread
 
struct  ThreadData
 

Public Types

typedef RunQueue< Task, 1024 > Queue
 
typedef Environment::Task Task
 

Public Member Functions

void Cancel () EIGEN_OVERRIDE
 
int CurrentThreadId () const EIGEN_FINAL
 
int NumThreads () const EIGEN_FINAL
 
void Schedule (std::function< void()> fn) EIGEN_OVERRIDE
 
void ScheduleWithHint (std::function< void()> fn, int start, int limit) override
 
void SetStealPartitions (const std::vector< std::pair< unsigned, unsigned >> &partitions)
 
 ThreadPoolTempl (int num_threads, bool allow_spinning, Environment env=Environment())
 
 ThreadPoolTempl (int num_threads, Environment env=Environment())
 
 ~ThreadPoolTempl ()
 
- Public Member Functions inherited from Eigen::ThreadPoolInterface
virtual ~ThreadPoolInterface ()
 

Private Types

typedef Environment::EnvThread Thread
 

Private Member Functions

void AssertBounds (int start, int end)
 
void ComputeCoprimes (int N, MaxSizeVector< unsigned > *coprimes)
 
void DecodePartition (unsigned val, unsigned *start, unsigned *limit)
 
unsigned EncodePartition (unsigned start, unsigned limit)
 
EIGEN_STRONG_INLINE PerThreadGetPerThread ()
 
unsigned GetStealPartition (int i)
 
Task GlobalSteal ()
 
Task LocalSteal ()
 
int NonEmptyQueueIndex ()
 
void SetStealPartition (size_t i, unsigned val)
 
Task Steal (unsigned start, unsigned limit)
 
bool WaitForWork (EventCount::Waiter *waiter, Task *t)
 
void WorkerLoop (int thread_id)
 

Static Private Member Functions

static EIGEN_STRONG_INLINE uint64_t GlobalThreadIdHash ()
 
static EIGEN_STRONG_INLINE unsigned Rand (uint64_t *state)
 

Private Attributes

MaxSizeVector< MaxSizeVector< unsigned > > all_coprimes_
 
const bool allow_spinning_
 
std::atomic< unsigned > blocked_
 
std::atomic< bool > cancelled_
 
std::atomic< bool > done_
 
EventCount ec_
 
Environment env_
 
unsigned global_steal_partition_
 
std::unique_ptr< Barrierinit_barrier_
 
const int num_threads_
 
std::unordered_map< uint64_t, std::unique_ptr< PerThread > > per_thread_map_
 
std::mutex per_thread_map_mutex_
 
std::atomic< bool > spinning_
 
MaxSizeVector< ThreadDatathread_data_
 
MaxSizeVector< EventCount::Waiterwaiters_
 

Static Private Attributes

static const int kMaxPartitionBits = 16
 
static const int kMaxThreads = 1 << kMaxPartitionBits
 

Detailed Description

template<typename Environment>
class Eigen::ThreadPoolTempl< Environment >

Definition at line 16 of file NonBlockingThreadPool.h.

Member Typedef Documentation

◆ Queue

template<typename Environment >
typedef RunQueue<Task, 1024> Eigen::ThreadPoolTempl< Environment >::Queue

Definition at line 19 of file NonBlockingThreadPool.h.

◆ Task

template<typename Environment >
typedef Environment::Task Eigen::ThreadPoolTempl< Environment >::Task

Definition at line 18 of file NonBlockingThreadPool.h.

◆ Thread

template<typename Environment >
typedef Environment::EnvThread Eigen::ThreadPoolTempl< Environment >::Thread
private

Definition at line 215 of file NonBlockingThreadPool.h.

Constructor & Destructor Documentation

◆ ThreadPoolTempl() [1/2]

template<typename Environment >
Eigen::ThreadPoolTempl< Environment >::ThreadPoolTempl ( int  num_threads,
Environment  env = Environment() 
)
inline

Definition at line 21 of file NonBlockingThreadPool.h.

◆ ThreadPoolTempl() [2/2]

template<typename Environment >
Eigen::ThreadPoolTempl< Environment >::ThreadPoolTempl ( int  num_threads,
bool  allow_spinning,
Environment  env = Environment() 
)
inline

Definition at line 24 of file NonBlockingThreadPool.h.

◆ ~ThreadPoolTempl()

template<typename Environment >
Eigen::ThreadPoolTempl< Environment >::~ThreadPoolTempl ( )
inline

Definition at line 67 of file NonBlockingThreadPool.h.

Member Function Documentation

◆ AssertBounds()

template<typename Environment >
void Eigen::ThreadPoolTempl< Environment >::AssertBounds ( int  start,
int  end 
)
inlineprivate

Definition at line 185 of file NonBlockingThreadPool.h.

◆ Cancel()

template<typename Environment >
void Eigen::ThreadPoolTempl< Environment >::Cancel ( )
inlinevirtual

Reimplemented from Eigen::ThreadPoolInterface.

Definition at line 138 of file NonBlockingThreadPool.h.

◆ ComputeCoprimes()

template<typename Environment >
void Eigen::ThreadPoolTempl< Environment >::ComputeCoprimes ( int  N,
MaxSizeVector< unsigned > *  coprimes 
)
inlineprivate

Definition at line 199 of file NonBlockingThreadPool.h.

◆ CurrentThreadId()

template<typename Environment >
int Eigen::ThreadPoolTempl< Environment >::CurrentThreadId ( ) const
inlinevirtual

Implements Eigen::ThreadPoolInterface.

Definition at line 155 of file NonBlockingThreadPool.h.

◆ DecodePartition()

template<typename Environment >
void Eigen::ThreadPoolTempl< Environment >::DecodePartition ( unsigned  val,
unsigned *  start,
unsigned *  limit 
)
inlineprivate

Definition at line 179 of file NonBlockingThreadPool.h.

◆ EncodePartition()

template<typename Environment >
unsigned Eigen::ThreadPoolTempl< Environment >::EncodePartition ( unsigned  start,
unsigned  limit 
)
inlineprivate

Definition at line 175 of file NonBlockingThreadPool.h.

◆ GetPerThread()

template<typename Environment >
EIGEN_STRONG_INLINE PerThread* Eigen::ThreadPoolTempl< Environment >::GetPerThread ( )
inlineprivate

Definition at line 456 of file NonBlockingThreadPool.h.

◆ GetStealPartition()

template<typename Environment >
unsigned Eigen::ThreadPoolTempl< Environment >::GetStealPartition ( int  i)
inlineprivate

Definition at line 195 of file NonBlockingThreadPool.h.

◆ GlobalSteal()

template<typename Environment >
Task Eigen::ThreadPoolTempl< Environment >::GlobalSteal ( )
inlineprivate

Definition at line 376 of file NonBlockingThreadPool.h.

◆ GlobalThreadIdHash()

template<typename Environment >
static EIGEN_STRONG_INLINE uint64_t Eigen::ThreadPoolTempl< Environment >::GlobalThreadIdHash ( )
inlinestaticprivate

Definition at line 452 of file NonBlockingThreadPool.h.

◆ LocalSteal()

template<typename Environment >
Task Eigen::ThreadPoolTempl< Environment >::LocalSteal ( )
inlineprivate

Definition at line 362 of file NonBlockingThreadPool.h.

◆ NonEmptyQueueIndex()

template<typename Environment >
int Eigen::ThreadPoolTempl< Environment >::NonEmptyQueueIndex ( )
inlineprivate

Definition at line 431 of file NonBlockingThreadPool.h.

◆ NumThreads()

template<typename Environment >
int Eigen::ThreadPoolTempl< Environment >::NumThreads ( ) const
inlinevirtual

Implements Eigen::ThreadPoolInterface.

Definition at line 153 of file NonBlockingThreadPool.h.

◆ Rand()

template<typename Environment >
static EIGEN_STRONG_INLINE unsigned Eigen::ThreadPoolTempl< Environment >::Rand ( uint64_t state)
inlinestaticprivate

Definition at line 472 of file NonBlockingThreadPool.h.

◆ Schedule()

template<typename Environment >
void Eigen::ThreadPoolTempl< Environment >::Schedule ( std::function< void()>  fn)
inlinevirtual

Implements Eigen::ThreadPoolInterface.

Definition at line 101 of file NonBlockingThreadPool.h.

◆ ScheduleWithHint()

template<typename Environment >
void Eigen::ThreadPoolTempl< Environment >::ScheduleWithHint ( std::function< void()>  fn,
int  start,
int  limit 
)
inlineoverridevirtual

Reimplemented from Eigen::ThreadPoolInterface.

Definition at line 105 of file NonBlockingThreadPool.h.

◆ SetStealPartition()

template<typename Environment >
void Eigen::ThreadPoolTempl< Environment >::SetStealPartition ( size_t  i,
unsigned  val 
)
inlineprivate

Definition at line 191 of file NonBlockingThreadPool.h.

◆ SetStealPartitions()

template<typename Environment >
void Eigen::ThreadPoolTempl< Environment >::SetStealPartitions ( const std::vector< std::pair< unsigned, unsigned >> &  partitions)
inline

Definition at line 88 of file NonBlockingThreadPool.h.

◆ Steal()

template<typename Environment >
Task Eigen::ThreadPoolTempl< Environment >::Steal ( unsigned  start,
unsigned  limit 
)
inlineprivate

Definition at line 336 of file NonBlockingThreadPool.h.

◆ WaitForWork()

template<typename Environment >
bool Eigen::ThreadPoolTempl< Environment >::WaitForWork ( EventCount::Waiter waiter,
Task t 
)
inlineprivate

Definition at line 384 of file NonBlockingThreadPool.h.

◆ WorkerLoop()

template<typename Environment >
void Eigen::ThreadPoolTempl< Environment >::WorkerLoop ( int  thread_id)
inlineprivate

Definition at line 254 of file NonBlockingThreadPool.h.

Member Data Documentation

◆ all_coprimes_

template<typename Environment >
MaxSizeVector<MaxSizeVector<unsigned> > Eigen::ThreadPoolTempl< Environment >::all_coprimes_
private

Definition at line 239 of file NonBlockingThreadPool.h.

◆ allow_spinning_

template<typename Environment >
const bool Eigen::ThreadPoolTempl< Environment >::allow_spinning_
private

Definition at line 237 of file NonBlockingThreadPool.h.

◆ blocked_

template<typename Environment >
std::atomic<unsigned> Eigen::ThreadPoolTempl< Environment >::blocked_
private

Definition at line 242 of file NonBlockingThreadPool.h.

◆ cancelled_

template<typename Environment >
std::atomic<bool> Eigen::ThreadPoolTempl< Environment >::cancelled_
private

Definition at line 245 of file NonBlockingThreadPool.h.

◆ done_

template<typename Environment >
std::atomic<bool> Eigen::ThreadPoolTempl< Environment >::done_
private

Definition at line 244 of file NonBlockingThreadPool.h.

◆ ec_

template<typename Environment >
EventCount Eigen::ThreadPoolTempl< Environment >::ec_
private

Definition at line 246 of file NonBlockingThreadPool.h.

◆ env_

template<typename Environment >
Environment Eigen::ThreadPoolTempl< Environment >::env_
private

Definition at line 235 of file NonBlockingThreadPool.h.

◆ global_steal_partition_

template<typename Environment >
unsigned Eigen::ThreadPoolTempl< Environment >::global_steal_partition_
private

Definition at line 241 of file NonBlockingThreadPool.h.

◆ init_barrier_

template<typename Environment >
std::unique_ptr<Barrier> Eigen::ThreadPoolTempl< Environment >::init_barrier_
private

Definition at line 248 of file NonBlockingThreadPool.h.

◆ kMaxPartitionBits

template<typename Environment >
const int Eigen::ThreadPoolTempl< Environment >::kMaxPartitionBits = 16
staticprivate

Definition at line 172 of file NonBlockingThreadPool.h.

◆ kMaxThreads

template<typename Environment >
const int Eigen::ThreadPoolTempl< Environment >::kMaxThreads = 1 << kMaxPartitionBits
staticprivate

Definition at line 173 of file NonBlockingThreadPool.h.

◆ num_threads_

template<typename Environment >
const int Eigen::ThreadPoolTempl< Environment >::num_threads_
private

Definition at line 236 of file NonBlockingThreadPool.h.

◆ per_thread_map_

template<typename Environment >
std::unordered_map<uint64_t, std::unique_ptr<PerThread> > Eigen::ThreadPoolTempl< Environment >::per_thread_map_
private

Definition at line 250 of file NonBlockingThreadPool.h.

◆ per_thread_map_mutex_

template<typename Environment >
std::mutex Eigen::ThreadPoolTempl< Environment >::per_thread_map_mutex_
private

Definition at line 249 of file NonBlockingThreadPool.h.

◆ spinning_

template<typename Environment >
std::atomic<bool> Eigen::ThreadPoolTempl< Environment >::spinning_
private

Definition at line 243 of file NonBlockingThreadPool.h.

◆ thread_data_

template<typename Environment >
MaxSizeVector<ThreadData> Eigen::ThreadPoolTempl< Environment >::thread_data_
private

Definition at line 238 of file NonBlockingThreadPool.h.

◆ waiters_

template<typename Environment >
MaxSizeVector<EventCount::Waiter> Eigen::ThreadPoolTempl< Environment >::waiters_
private

Definition at line 240 of file NonBlockingThreadPool.h.


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


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:12:53