2014-05-11 01:02:09 +08:00
<ompt s : test >
2014-06-02 02:28:36 +08:00
<ompt s : testdescription > Test which checks the omp single directive by con trolling how often a directive is called in an omp single region.</ompts:testdescription>
2014-05-11 01:02:09 +08:00
<ompt s : ompversion > 2.0 < / ompts : ompversion >
<ompt s : directive > omp single < / ompts : directive >
<ompt s : dependences > omp parallel private , omp flush < / ompts : dependences >
<ompt s : testcode >
INTEGER FUNCTION < ompts : testcode : functionname > omp_single < / ompts : te stcode:functionname>()
IMPLICIT NONE
INTEGER i
<om p ts : orphan : vars >
INTEGER nr_threads_in_single , nr_iterations , result
COMMON / orphvars / nr_threads_in_single , nr_iterations , result
</o m pts : orphan : vars >
INCLUDE "omp_testsuite.f"
nr_threads_in_single = 0
result = 0
nr_iterations = 0
!$omp parallel
DO i = 0 , LOOPCOUNT - 1
<om p ts : orphan >
!$omp single
!$omp flush
nr_threads_in_single = nr_threads_in_single + 1
!$omp flush
nr_iterations = nr_iterations + 1
< ompts : check > nr_threads_in_single = nr_threads_in_single - 1 < / ompts:check>
< ompts : crosscheck > nr_threads_in_single = nr_threads_in_single + 1</ompts:crosscheck>
result = result + nr_threads_in_single
!$omp end single
</o m pts : orphan >
END DO
!$omp end parallel
IF ( result . EQ . 0 . AND . nr_iterations . EQ . LOOPCOUNT ) THEN
< testfunctionname > < / testfunctionname > = 1
ELSE
< testfunctionname > < / testfunctionname > = 0
END IF
END FUNCTION
</omp t s : testcode >
</omp t s : test >