Nektar++
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Nektar::Thread::ThreadStartupManager Class Reference

A default ThreadManager. More...

#include <Thread.h>

Inheritance diagram for Nektar::Thread::ThreadStartupManager:
[legend]

Public Member Functions

 ThreadStartupManager ()
 ThreadDefaultManager. More...
 
 ThreadStartupManager (const ThreadStartupManager &src)=default
 
virtual ~ThreadStartupManager ()
 
- Public Member Functions inherited from Nektar::Thread::ThreadManager
virtual ~ThreadManager ()
 Destructor. More...
 
void QueueJobs (std::vector< ThreadJob * > &joblist)
 Pass a list of tasklets to the master queue. More...
 
void QueueJob (ThreadJob *job)
 Pass a single job to the master queue. More...
 
unsigned int GetNumWorkers ()
 Return the number of active workers. More...
 
unsigned int GetWorkerNum ()
 Returns the worker number of the executing thread. More...
 
void SetNumWorkers (const unsigned int num)
 Sets the number of active workers. More...
 
void SetNumWorkers ()
 Sets the number of active workers to the maximum. More...
 
unsigned int GetMaxNumWorkers ()
 Gets the maximum available number of threads. More...
 
void Wait ()
 Waits until all queued jobs are finished. More...
 
void SetChunkSize (unsigned int chnk)
 Controls how many jobs are sent to each worker at a time. More...
 
void SetSchedType (SchedType s)
 Sets the current scheduling algorithm. More...
 
bool InThread ()
 Indicates whether the code is in a worker thread or not. More...
 
void Hold ()
 A calling threads holds until all active threads call this method. More...
 
const std::string & GetType ()
 Returns a description of the type of threading. More...
 
bool IsInitialised ()
 ThreadManager implementation. More...
 
int GetThrFromPartition (int pPartition)
 
int GetRankFromPartition (int pPartition)
 
int GetPartitionFromRankThr (int pRank, unsigned int pThr)
 

Protected Member Functions

virtual void v_QueueJobs (std::vector< ThreadJob * > &joblist) override
 
virtual void v_QueueJob (ThreadJob *job) override
 
virtual unsigned int v_GetNumWorkers () override
 
virtual unsigned int v_GetWorkerNum () override
 
virtual void v_SetNumWorkers (const unsigned int num) override
 
virtual void v_SetNumWorkers () override
 
virtual unsigned int v_GetMaxNumWorkers () override
 
virtual void v_Wait () override
 
virtual void v_SetChunkSize (unsigned int chnk) override
 
virtual void v_SetSchedType (SchedType s) override
 
virtual bool v_InThread () override
 
virtual void v_Hold () override
 
virtual bool v_IsInitialised () override
 
virtual const std::string & v_GetType () const override
 

Private Member Functions

ThreadStartupManageroperator= (const ThreadStartupManager &src)
 ThreadDefaultManager copy constructor. More...
 

Private Attributes

const std::string m_type
 

Detailed Description

A default ThreadManager.

This will be returned by ThreadMaster if a ThreadManager has not been initialised, such as if the code is still in static initialisation.

This manager pretends to be a ThreadManager with 1 thread. It will cause an error if anything more than trivial functions are called.

Definition at line 438 of file Thread.h.

Constructor & Destructor Documentation

◆ ThreadStartupManager() [1/2]

Nektar::Thread::ThreadStartupManager::ThreadStartupManager ( )

ThreadDefaultManager.

Definition at line 196 of file Thread.cpp.

196  : m_type("Threading starting up")
197 {
198  // empty
199 }

◆ ThreadStartupManager() [2/2]

Nektar::Thread::ThreadStartupManager::ThreadStartupManager ( const ThreadStartupManager src)
default

◆ ~ThreadStartupManager()

Nektar::Thread::ThreadStartupManager::~ThreadStartupManager ( )
virtual

Definition at line 204 of file Thread.cpp.

205 {
206  // empty
207 }

Member Function Documentation

◆ operator=()

ThreadStartupManager & Nektar::Thread::ThreadStartupManager::operator= ( const ThreadStartupManager src)
private

ThreadDefaultManager copy constructor.

Definition at line 333 of file Thread.cpp.

335 {
336  boost::ignore_unused(src);
337  return *this;
338 }

◆ v_GetMaxNumWorkers()

unsigned int Nektar::Thread::ThreadStartupManager::v_GetMaxNumWorkers ( )
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 265 of file Thread.cpp.

266 {
267  return 1;
268 }

◆ v_GetNumWorkers()

unsigned int Nektar::Thread::ThreadStartupManager::v_GetNumWorkers ( )
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 232 of file Thread.cpp.

233 {
234  return 1;
235 }

◆ v_GetType()

const std::string & Nektar::Thread::ThreadStartupManager::v_GetType ( ) const
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 325 of file Thread.cpp.

326 {
327  return m_type;
328 }

References m_type.

◆ v_GetWorkerNum()

unsigned int Nektar::Thread::ThreadStartupManager::v_GetWorkerNum ( )
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 240 of file Thread.cpp.

241 {
242  return 0;
243 }

◆ v_Hold()

void Nektar::Thread::ThreadStartupManager::v_Hold ( )
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 309 of file Thread.cpp.

310 {
311  return;
312 }

◆ v_InThread()

bool Nektar::Thread::ThreadStartupManager::v_InThread ( )
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 301 of file Thread.cpp.

302 {
303  return false;
304 }

◆ v_IsInitialised()

bool Nektar::Thread::ThreadStartupManager::v_IsInitialised ( )
overrideprotectedvirtual

Implementations should not override this function, since they are initialised.

Returns
True if this ThreadManager has been initialised.

Reimplemented from Nektar::Thread::ThreadManager.

Definition at line 317 of file Thread.cpp.

318 {
319  return false;
320 }

◆ v_QueueJob()

void Nektar::Thread::ThreadStartupManager::v_QueueJob ( ThreadJob job)
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 222 of file Thread.cpp.

223 {
224  boost::ignore_unused(job);
226  "Attempted to QueueJob in ThreadDefaultManager");
227 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209

References Nektar::ErrorUtil::efatal, and NEKERROR.

◆ v_QueueJobs()

void Nektar::Thread::ThreadStartupManager::v_QueueJobs ( std::vector< ThreadJob * > &  joblist)
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 212 of file Thread.cpp.

213 {
214  boost::ignore_unused(joblist);
216  "Attempted to QueueJobs in ThreadDefaultManager");
217 }

References Nektar::ErrorUtil::efatal, and NEKERROR.

◆ v_SetChunkSize()

void Nektar::Thread::ThreadStartupManager::v_SetChunkSize ( unsigned int  chnk)
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 281 of file Thread.cpp.

282 {
283  boost::ignore_unused(chnk);
285  "Attempted to SetChunkSize in ThreadDefaultManager");
286 }

References Nektar::ErrorUtil::efatal, and NEKERROR.

◆ v_SetNumWorkers() [1/2]

void Nektar::Thread::ThreadStartupManager::v_SetNumWorkers ( )
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 257 of file Thread.cpp.

258 {
259  return;
260 }

◆ v_SetNumWorkers() [2/2]

void Nektar::Thread::ThreadStartupManager::v_SetNumWorkers ( const unsigned int  num)
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 248 of file Thread.cpp.

249 {
250  ASSERTL0(num == 1,
251  "Attempted to SetNumWorkers to != 1 in ThreadDefaultManager");
252 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215

References ASSERTL0.

◆ v_SetSchedType()

void Nektar::Thread::ThreadStartupManager::v_SetSchedType ( SchedType  s)
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 291 of file Thread.cpp.

292 {
293  boost::ignore_unused(s);
295  "Attempted to SetSchedType in ThreadDefaultManager");
296 }

References Nektar::ErrorUtil::efatal, and NEKERROR.

◆ v_Wait()

void Nektar::Thread::ThreadStartupManager::v_Wait ( )
overrideprotectedvirtual

Implements Nektar::Thread::ThreadManager.

Definition at line 273 of file Thread.cpp.

274 {
275  return;
276 }

Member Data Documentation

◆ m_type

const std::string Nektar::Thread::ThreadStartupManager::m_type
private

Definition at line 465 of file Thread.h.

Referenced by v_GetType().