42 if (omp_get_thread_num() == 0) {
43 Nthread_env = omp_get_num_threads();
48 if ((Nthread == Nthread_env) || (Nthread == 0)) {
54 omp_set_num_threads(Nthread);
74 return omp_get_num_threads();
81 return omp_get_thread_num();
115 const int i_thread,
const int Nthread)
125 #pragma omp flush (m_darray_reduction)
126 for (
int i = 0; i < Nthread; ++i) {
132 #pragma omp flush (m_darray_reduction)
155 vout.
crucial(
m_vl,
"Single-thread %s is called in parallel region.\n", name.c_str());
static int m_Nthread
number of threads.
static int get_num_threads()
returns available number of threads.
void general(const char *format,...)
static Bridge::VerboseLevel Vlevel()
static void wait()
barrier among threads inside a node.
static int get_thread_id()
returns thread id.
static void init(int Nthread)
setup: called in main only once.
static const std::string class_name
static void barrier(const int Nthread)
barrier among threads inside a node.
static void reduce_sum_global(double &value, const int i_thread, const int Nthread)
global reduction with summation: value is assumed thread local.
static void sync_barrier_all()
barrier among all the threads and nodes.
static void finalize()
finalization.
void paranoiac(const char *format,...)
void crucial(const char *format,...)
static Bridge::VerboseLevel m_vl
verbose level.
static std::vector< double > m_darray_reduction
static int reduce_sum(int count, double *recv_buf, double *send_buf, int pattern=0)
make a global sum of an array of double over the communicator. pattern specifies the dimensions to be...
static int sync()
synchronize within small world.
static void assert_single_thread(const std::string &classname)
assert currently running on single thread.