Computing p with Shared Memory
Notes:
- essentially sequential form
- automatic work sharing
- all variables shared by default
- directives to request parallel work distribution
- number of processors specified outside of the code
double pi, l, ls = 0.0, w = 1.0/n;
#pragma omp parallel private(i,l) reduction(+:ls)
printf(“pi is %f\n”,ls*w);