4304325306293793a58ee81e8971f4424b649bf5
2 #include "00_pi_tools.h"
5 /*----------------------------------------------------------------------*\
7 \*---------------------------------------------------------------------*/
9 /*--------------------------------------*\
11 \*-------------------------------------*/
13 /*--------------------------------------*\
15 \*-------------------------------------*/
17 bool isPiOMPEntrelacerCritical_Ok(int n
);
19 /*--------------------------------------*\
21 \*-------------------------------------*/
23 static double piOMPEntrelacerCritical(int n
);
25 /*----------------------------------------------------------------------*\
27 \*---------------------------------------------------------------------*/
29 /*--------------------------------------*\
31 \*-------------------------------------*/
33 bool isPiOMPEntrelacerCritical_Ok(int n
)
35 return isAlgoPI_OK(piOMPEntrelacerCritical
, n
, "Pi OMP Entrelacer critical");
38 /*--------------------------------------*\
40 \*-------------------------------------*/
42 double piOMPEntrelacerCritical(int n
)
44 const int NB_THREAD
= OmpTools::setAndGetNaturalGranularity();
45 const double DX
= 1.0/(double)n
;
51 double sumLocalThread
= 0;
52 const int TID
= OmpTools::getTid();
58 sumLocalThread
+= fpi(xs
);
62 #pragma omp critical(sum_fpi)
63 sum
+= sumLocalThread
;
70 /*----------------------------------------------------------------------*\
72 \*---------------------------------------------------------------------*/