a7d1de13199e5435a23eee382212427362cd747f
4 #define MULTIPLIER 1366
9 #pragma omp threadprivate(random_last)
11 /*----------------------------------------------------------------------*\
13 \*---------------------------------------------------------------------*/
15 /*--------------------------------------*\
17 \*-------------------------------------*/
29 /*--------------------------------------*\
31 \*-------------------------------------*/
33 /*----------------------*\
35 \*---------------------*/
37 int OmpTools::setAndGetNaturalGranularity()
39 // ko sur ARM, 1 core detecte only
41 // int nbThread = omp_get_num_procs();
42 // omp_set_num_threads(nbThread);
48 int nbThread
= omp_get_num_procs();
52 //omp_get_num_procs ne donne pas la bonne valeurs sur kayla
54 int nbThread
=4;//4 car kayla à 4 coeurs.
58 omp_set_num_threads(nbThread
);
66 int OmpTools::getNbCore()
68 return omp_get_num_procs();
71 int OmpTools::getNbThread()
73 return omp_get_num_threads();
76 int OmpTools::getTid()
78 return omp_get_thread_num();
85 void OmpTools::setNbThread(int nbThread
)
87 omp_set_num_threads(nbThread
);
94 double OmpTools::uniform01(void)
98 random_next
= (MULTIPLIER
* random_last
+ ADDEND
) % PMOD
;
99 random_last
= random_next
;
101 return ((double) random_next
/ (double) PMOD
);
104 double OmpTools::uniform(double a
, double b
)
106 return a
+ uniform01() * (b
- a
);
109 /*----------------------------------------------------------------------*\
111 \*---------------------------------------------------------------------*/