Parallelizing a loop and not knowing whether there are side effects? |
subroutine foo(n) |
common /foobar/a(1000),b(1000),x |
c$omp parallel do shared(a,b,n) lastprivate(x) |
do 10 i=1,n |
x=a(i)**2 + b(i)**2 |
10 b(i)= sqrt(x) |
end |
Use lastprivate because don't |
know where or if x in common |
/foobar/ will be used again |