#C
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
int private_nloops, nloops;
= 0;
nloops
#pragma omp parallel private(private_nloops) \
reduction(+ : nloops)
{
= 0;
private_nloops
#pragma omp for
for (i=0; i<100000; ++i)
{
++private_nloops;
}
/* Reduction step - reduce 'private_nloops' into 'nloops' */
= nloops + private_nloops;
nloops }
("The total number of loop iterations is %d\n",
printf);
nloops
return 0;
}