I want to use the reduction clause to parallelize something like this:
- Code: Select all
.
.
.
#pragma parallel for ... reduction(+: sum_1, sum_2, ..., sum_100)
for(i=0; i<N; i++)
{
if(proposition_1) sum_1++;
if(proposition_2) sum_2++;
...
if(proposition_100) sum_100++;
}
.
.
.
and I know the variables sum_i have to be scalars.
Does I have to write down each "if(proposition_i) sum_i ++ "" or is there a better way to do this?
