Basic HTML version of Foils prepared August 29 98

Foil 50 OpenMP Example

From Designing and Building Parallel Programs I: Introduction DoD Modernization Tutorial -- 1995-1998. by Ian Foster, Gina Goff, Ehtesham Hayder, Chuck Koelbel


1 !$OMP PARALLEL DO, SHARED(A,B,C), &
2 !$OMP REDUCTION(X), &
3 !$OMP SCHEDULE(DYNAMIC, 100)
  • DO I = 2, N-1
    • A(I) = (B(I-1)+B(I)+B(I+1)) / 3
    • X = X + A(I)/C(I)
  • END DO
4 !$OMP END DO
5 !$OMP PARALLEL DO, SHARED(D,E), &
6 !$OMP SCHEDULE(STATIC)
  • DO I = 1, N
    • D(I) = SIN(E(I))
  • END DO
7 !$OMP END DO
8 X is a summation
9 Iterations managed first-come, first-served, in blocks of 100
10 Iterations blocked evenly among threads (GUIDED scheduling also available)

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