blob: 65e1f3d07c403bb3a0f1bdd484a567b733cb579e [file] [log] [blame]
Jim Cownie18d84732014-05-10 17:02:09 +00001<ompts:test>
2<ompts:testdescription>Test which checks the omp master directive by counting up a variable in a omp master section.</ompts:testdescription>
3<ompts:ompversion>2.0</ompts:ompversion>
4<ompts:directive>omp master</ompts:directive>
5<ompts:dependences>omp critical</ompts:dependences>
6<ompts:testcode>
7 INTEGER FUNCTION <ompts:testcode:functionname>omp_master</ompts:testcode:functionname>()
8 IMPLICIT NONE
9 INTEGER omp_get_thread_num
10 <ompts:orphan:vars>
11 INTEGER nthreads, executing_thread
12 COMMON /orphvars/ nthreads, executing_thread
13 </ompts:orphan:vars>
14 nthreads=0
15 executing_thread=-1
16
17!$omp parallel
18 <ompts:orphan>
19 <ompts:check>
20!$omp master
21 </ompts:check>
22!$omp critical
23 nthreads = nthreads + 1
24!$omp end critical
25 executing_thread=omp_get_thread_num()
26 <ompts:check>
27!$omp end master
28 </ompts:check>
29 </ompts:orphan>
30!$omp end parallel
31
32 IF ( (nthreads .EQ. 1) .AND. (executing_thread .EQ. 0) ) THEN
33 <testfunctionname></testfunctionname> = 1
34 ELSE
35 <testfunctionname></testfunctionname> = 0
36 END IF
37 END
38</ompts:testcode>
39</ompts:test>