Ordered / End Ordered

  • ORDERED / END ORDERED
    • For pipelining loop iterations
    • Can exist only in the dynamic extent of a DO or PARALLEL DO directive
    • The DO directive to which it binds must have the ORDERED clause specified
    • Only one thread can enter at a time
    • Illegal to branch into or out of ORDERED code section
      !$OMP DO ORDERED SCHEDULED(DYNAMIC)
             DO I=LB,UB,ST
              CALL WORK(I)
             ENDDO
      
             SUBROUTINE WORK(K)
      !$OMP ORDERED
             WRITE(*,*) K
      !$OMP END ORDERED
             END