Implicit Barriers

  • Implicit barriers wait for all threads
    • DO / END DO (also PARALLEL DO / END PARALLEL DO)
    • SECTIONS / END SECTIONS (also PARALLEL SECTIONS / END PARALLEL SECTIONS)
    • SINGLE / END SINGLE
      • Note: For MASTER / END MASTER - no implied barrier synch
    • NOWAIT at END overrides synch
    • Global barriers => all threads must hit in the same order
!$OMP PARALLEL
!$OMP DO
   DO I=2, N
      B(I) = (A(I) + A(I-1)) / 2.0
   ENDDO
!$OMP END DO NOWAIT
!OMP DO
   DO I=1, M
     Y(I) = SQRT (Z(I))
   ENDDO
!$OMP END DO NOWAIT
!$OMP END PARALLEL