Basic HTML version of Foils prepared August 29 98

Foil 40 Firstprivate and Lastprivate (2)

From Designing and Building Parallel Programs 2: openMP Shared Memory Programming Language DoD Modernization Tutorial -- 1995-1998. by Ian Foster, Gina Goff, Ehtesham Hayder, Chuck Koelbel(Some foils prepared by Kuck & Associates, Inc.)


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

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Apr 11 1999