blob: e8821cac730747eff5fd646955de7fe95d69300f [file] [log] [blame]
Jim Cownie18d84732014-05-10 17:02:09 +00001<ompts:test>
Alp Tokerc2d5e612014-06-01 18:28:36 +00002<ompts:testdescription>Test which checks the omp single directive by controlling how often a directive is called in an omp single region.</ompts:testdescription>
Jim Cownie18d84732014-05-10 17:02:09 +00003<ompts:ompversion>2.0</ompts:ompversion>
4<ompts:directive>omp single</ompts:directive>
5<ompts:dependences>omp parallel private,omp flush</ompts:dependences>
6<ompts:testcode>
7 INTEGER FUNCTION <ompts:testcode:functionname>omp_single</ompts:testcode:functionname>()
8 IMPLICIT NONE
9 INTEGER i
10 <ompts:orphan:vars>
11 INTEGER nr_threads_in_single,nr_iterations,result
12 COMMON /orphvars/ nr_threads_in_single,nr_iterations,result
13 </ompts:orphan:vars>
14 INCLUDE "omp_testsuite.f"
15 nr_threads_in_single=0
16 result=0
17 nr_iterations=0
18!$omp parallel
19 DO i=0, LOOPCOUNT-1
20 <ompts:orphan>
21!$omp single
22!$omp flush
23 nr_threads_in_single = nr_threads_in_single + 1
24!$omp flush
25 nr_iterations = nr_iterations + 1
26 <ompts:check>nr_threads_in_single = nr_threads_in_single - 1</ompts:check>
27 <ompts:crosscheck>nr_threads_in_single = nr_threads_in_single + 1</ompts:crosscheck>
28 result = result + nr_threads_in_single
29!$omp end single
30 </ompts:orphan>
31 END DO
32!$omp end parallel
33 IF ( result .EQ. 0 .AND. nr_iterations .EQ. LOOPCOUNT ) THEN
34 <testfunctionname></testfunctionname> = 1
35 ELSE
36 <testfunctionname></testfunctionname> = 0
37 END IF
38 END FUNCTION
39</ompts:testcode>
40</ompts:test>