544224f0404fe467718040b14332f25347e0a6c0
2 #include "00_pi_tools.h"
5 /*----------------------------------------------------------------------*\
7 \*---------------------------------------------------------------------*/
9 /*--------------------------------------*\
11 \*-------------------------------------*/
15 /*--------------------------------------*\
17 \*-------------------------------------*/
19 bool isPiOMPforReduction_Ok(int n
);
21 /*--------------------------------------*\
23 \*-------------------------------------*/
25 static double piOMPforReduction(int n
);
27 /*----------------------------------------------------------------------*\
29 \*---------------------------------------------------------------------*/
31 /*--------------------------------------*\
33 \*-------------------------------------*/
35 bool isPiOMPforReduction_Ok(int n
)
37 return isAlgoPI_OK(piOMPforReduction
, n
, "Pi OMP for reduction-integrer");
40 /*--------------------------------------*\
42 \*-------------------------------------*/
45 * pattern omp usefull : idem desyncronisation-promotionTab ,mais avec syntaxe plus courte!
46 * Si on enleve le pragma, le code est le meme que le sequentiel!
48 double piOMPforReduction(int n
)
52 const double DX
= 1.0/(double)n
;
54 #pragma omp parallel for private(xi) reduction(+:sum)
55 for (int i
= 0; i
< n
; i
++)
67 /*----------------------------------------------------------------------*\
69 \*---------------------------------------------------------------------*/