26 #ifndef _GEMA_OPENMP_H_ 27 #define _GEMA_OPENMP_H_ 38 assert(maxThreads > 0);
40 omp_set_num_threads(maxThreads);
54 int mt = omp_get_max_threads();
56 return (nt > 0 && nt <= mt) ? nt : mt;
69 return omp_get_thread_num();
76 #define GM_OMP_ASSERT_NO_DYNAMIC assert(omp_get_dynamic() == 0) 78 #define GM_OMP_ASSERT_NO_DYNAMIC ((void)0) int GmOmpThreadNum()
Returns the current Open Mp thread number (omp_get_thread_num()).
Definition: gmOmp.h:66
int GmOmpAdjustNumThreads(int nt)
Adjusts the given number of threads. If nt <= 0 or if nt > maximum number of omp threads,...
Definition: gmOmp.h:51
void GmOmpInit(int maxThreads)
Initializes OpenMP to use the given maximum number of threads. It also disables dynamic scheduling.
Definition: gmOmp.h:36