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


!$OMP PARALLEL DO, SHARED(A,B,C), &
!$OMP REDUCTION(X), &
!$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
!$OMP END DO
!$OMP PARALLEL DO, SHARED(D,E), &
!$OMP SCHEDULE(STATIC)
  • DO I = 1, N
    • D(I) = SIN(E(I))
  • END DO
!$OMP END DO
X is a summation
Iterations managed first-come, first-served, in blocks of 100
Iterations blocked evenly among threads (GUIDED scheduling also available)



© 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