I'm trying to understand the behaviour of the reduction clause with the following program
- Code: Select all
#pragma omp parallel for default(none) shared(v)\
printf("thread %i - number %.1f\n",crt,v[i]);
printf("The result is: %f\n",sum);
I know i should have used reduction(+:sum) instead. I wanted to know if reduction(*:sum) computed the product of the local sums for each thread ... which does not happen - the result is 0.
Why is this happening?