Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ThreadManager_OpenMP Class Reference

Thread manager with OpenMP. More...

#include <threadManager_OpenMP.h>

Static Public Member Functions

static void init (int Nthread)
 setup: called in main only once. More...
 
static void finalize ()
 finalization. More...
 
static int get_num_threads_available ()
 returns number of threads (works outside of parallel region). More...
 
static int get_num_threads ()
 returns available number of threads. More...
 
static int get_thread_id ()
 returns thread id. More...
 
static void wait ()
 barrier among threads inside a node. More...
 
static void barrier (const int Nthread)
 barrier among threads inside a node. More...
 
static void sync_barrier_all ()
 barrier among all the threads and nodes. More...
 
static void reduce_sum_global (double &value, const int i_thread, const int Nthread)
 global reduction with summation: value is assumed thread local. More...
 
static void assert_single_thread (const std::string &class_name)
 assert currently running on single thread. More...
 

Static Public Attributes

static const std::string class_name = "ThreadManager_OpenMP"
 

Private Member Functions

 ThreadManager_OpenMP (const ThreadManager_OpenMP &)
 
ThreadManager_OpenMPoperator= (const ThreadManager_OpenMP &)
 

Static Private Attributes

static int m_Nthread = 0
 number of threads. More...
 
static Bridge::VerboseLevel m_vl = Bridge::CRUCIAL
 verbose level. More...
 
static std::vector< double > m_darray_reduction
 

Detailed Description

Thread manager with OpenMP.

This class wraps OpenMP API functions. The number of available threads is specified as an argument of init() function, which is to be called at the begining of main, soon after Communicator and CommonParameter are initialized. If the specified number of threads (nthread) is not the same as that of OMP_NUM_THREADS environment variable, the number of threads is set to the specified one. If Nthread = 0 is specified, the number of threads is set to OMP_NUM_THREADS or maximum number of platform. [29 Aug 2013 H.Matsufuru]

Definition at line 40 of file threadManager_OpenMP.h.

Constructor & Destructor Documentation

ThreadManager_OpenMP::ThreadManager_OpenMP ( const ThreadManager_OpenMP )
private

Member Function Documentation

void ThreadManager_OpenMP::assert_single_thread ( const std::string &  class_name)
static

assert currently running on single thread.

Definition at line 154 of file threadManager_OpenMP.cpp.

void ThreadManager_OpenMP::barrier ( const int  Nthread)
static

barrier among threads inside a node.

Definition at line 95 of file threadManager_OpenMP.cpp.

void ThreadManager_OpenMP::finalize ( )
static

finalization.

Definition at line 65 of file threadManager_OpenMP.cpp.

int ThreadManager_OpenMP::get_num_threads ( )
static

returns available number of threads.

Definition at line 72 of file threadManager_OpenMP.cpp.

static int ThreadManager_OpenMP::get_num_threads_available ( )
inlinestatic

returns number of threads (works outside of parallel region).

Definition at line 61 of file threadManager_OpenMP.h.

int ThreadManager_OpenMP::get_thread_id ( )
static

returns thread id.

Definition at line 79 of file threadManager_OpenMP.cpp.

void ThreadManager_OpenMP::init ( int  Nthread)
static

setup: called in main only once.

Definition at line 32 of file threadManager_OpenMP.cpp.

ThreadManager_OpenMP& ThreadManager_OpenMP::operator= ( const ThreadManager_OpenMP )
private
void ThreadManager_OpenMP::reduce_sum_global ( double &  value,
const int  i_thread,
const int  Nthread 
)
static

global reduction with summation: value is assumed thread local.

Definition at line 114 of file threadManager_OpenMP.cpp.

void ThreadManager_OpenMP::sync_barrier_all ( )
static

barrier among all the threads and nodes.

Definition at line 102 of file threadManager_OpenMP.cpp.

void ThreadManager_OpenMP::wait ( )
static

barrier among threads inside a node.

Definition at line 86 of file threadManager_OpenMP.cpp.

Member Data Documentation

const std::string ThreadManager_OpenMP::class_name = "ThreadManager_OpenMP"
static

Definition at line 52 of file threadManager_OpenMP.h.

std::vector< double > ThreadManager_OpenMP::m_darray_reduction
staticprivate

Definition at line 44 of file threadManager_OpenMP.h.

int ThreadManager_OpenMP::m_Nthread = 0
staticprivate

number of threads.

Definition at line 42 of file threadManager_OpenMP.h.

Bridge::VerboseLevel ThreadManager_OpenMP::m_vl = Bridge::CRUCIAL
staticprivate

verbose level.

Definition at line 43 of file threadManager_OpenMP.h.


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