Void parallel_sum ()
{
STD: : vectorNums (1000);
For (int I=1; I & lt;=1000; + + I)
Nums [I - 1]=I;
Int sum=0;
# pragma omp parallel for reduction (+ : sum)
For (int I=0; I & lt; 1000; + + I)
Sum=sum + nums [I];
}
Consult!
CodePudding user response:
Don't Shared memory address,CodePudding user response: