Test which checks the omp single directive by controlling how often a directive is called in an omp single region.
2.0
omp single
omp parallel private,omp flush
INTEGER FUNCTION omp_single()
IMPLICIT NONE
INTEGER i
INTEGER nr_threads_in_single,nr_iterations,result
COMMON /orphvars/ nr_threads_in_single,nr_iterations,result
INCLUDE "omp_testsuite.f"
nr_threads_in_single=0
result=0
nr_iterations=0
!$omp parallel
DO i=0, LOOPCOUNT-1
!$omp single
!$omp flush
nr_threads_in_single = nr_threads_in_single + 1
!$omp flush
nr_iterations = nr_iterations + 1
nr_threads_in_single = nr_threads_in_single - 1
nr_threads_in_single = nr_threads_in_single + 1
result = result + nr_threads_in_single
!$omp end single
END DO
!$omp end parallel
IF ( result .EQ. 0 .AND. nr_iterations .EQ. LOOPCOUNT ) THEN
= 1
ELSE
= 0
END IF
END FUNCTION