blob: c07ab2fdd832b957442a592e77b57da7490e5185 [file] [log] [blame]
Jim Cownie18d84732014-05-10 17:02:09 +00001<ompts:test>
2<ompts:testdescription>Test which checks the if clause of the omp task directive. The idear of the tests is to generate a tasks in a single region and pause it immediately. The parent thread now shall set a counter variable which the paused task shall evaluate when woke up.</ompts:testdescription>
3<ompts:ompversion>3.0</ompts:ompversion>
4<ompts:directive>omp task if</ompts:directive>
5<ompts:dependences>omp single,omp flush</ompts:dependences>
6<ompts:testcode>
7#include <stdio.h>
8#include <math.h>
9#include "omp_testsuite.h"
10#include "omp_my_sleep.h"
11
12
13int <ompts:testcode:functionname>omp_task_if</ompts:testcode:functionname>(FILE * logFile){
14 <ompts:orphan:vars>
15 int condition_false;
16 int count;
17 int result;
18 </ompts:orphan:vars>
19 count=0;
20 condition_false = (logFile == NULL);
21#pragma omp parallel
22{
23#pragma omp single
24 {
25 <ompts:orphan>
26#pragma omp task <ompts:check>if (condition_false)</ompts:check> shared(count, result)
27 {
28 my_sleep (SLEEPTIME_LONG);
29//#pragma omp flush (count)
30 result = (0 == count);
31 } /* end of omp task */
32 </ompts:orphan>
33
34 count = 1;
35//#pragma omp flush (count)
36
37 } /* end of single */
38} /*end of parallel */
39
40 return result;
41}
42</ompts:testcode>
43</ompts:test>