Test with omp for collapse clause. Bind with two loops. Without the collapse clause, the first loop will not be ordered
3.0
omp do collapse
omp critical,omp do schedule
LOGICAL FUNCTION check_is_larger(i)
implicit none
INTEGER :: i
INTEGER, save :: last_i
LOGICAL :: is_larger
if (i .eq. 1) last_i = 0
is_larger = (i .ge. last_i) .and. ((i-last_i) .le. 1)
last_i = i
check_is_larger = is_larger
END FUNCTION check_is_larger
INTEGER FUNCTION do_collapse()
IMPLICIT NONE
INTEGER i, j
LOGICAL check_is_larger
LOGICAL my_is_larger
LOGICAL is_larger
COMMON /orphvars/ is_larger
INCLUDE "omp_testsuite.f"
is_larger = .true.
!$omp parallel private(my_is_larger)
my_is_larger = .true.
!$omp do private(i,j) schedule(static,1) collapse(2)
!$omp+ ordered
DO i=1,100
my_is_larger = check_is_larger(i) .and. my_is_larger
DO j=1,00
!$omp ordered
my_is_larger = check_is_larger(i) .and. my_is_larger
!$omp end ordered
END DO
END DO
!$omp end do
!$omp critical
is_larger = is_larger .and. my_is_larger
!$omp end critical
!$omp end parallel
if (is_larger) then
= 1
else
= 0
end if
END FUNCTION