blob: cdb2f1e1bee8e841ee48dd74cf1fa4b9938ce4ea [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#include <stdio.h>
8#include "omp_testsuite.h"
9
10int <ompts:testcode:functionname>omp_master</ompts:testcode:functionname>(FILE * logFile)
11{
12 <ompts:orphan:vars>
13 int nthreads;
14 int executing_thread;
15 </ompts:orphan:vars>
16
17 nthreads = 0;
18 executing_thread = -1;
19
20#pragma omp parallel
21 {
22 <ompts:orphan>
23 <ompts:check>#pragma omp master </ompts:check>
24 {
25#pragma omp critical
26 {
27 nthreads++;
28 }
29 executing_thread = omp_get_thread_num ();
30
31 } /* end of master*/
32 </ompts:orphan>
33 } /* end of parallel*/
34 return ((nthreads == 1) && (executing_thread == 0));
35}
36</ompts:testcode>
37</ompts:test>