blob: 74c2109e3ac98e4605793ae855d407a859b79815 [file] [log] [blame]
Jim Cownie18d84732014-05-10 17:02:09 +00001<ompts:test>
2<ompts:testdescription> Test to see if implied shared works correctly</ompts:testdescription>
3<ompts:ompversion>3.0</ompts:ompversion>
4<ompts:directive>omp task</ompts:directive>
5<ompts:dependences>omp single, omp task firstprivate</ompts:dependences>
6<ompts:testcode>
7#include <stdio.h>
8#include <math.h>
9#include "omp_testsuite.h"
10
11
12
13
14/* Utility function do spend some time in a loop */
15int <ompts:testcode:functionname>omp_task_imp_shared</ompts:testcode:functionname> (FILE * logFile)
16{
17 <ompts:orphan:vars>
18 int i;
19 </ompts:orphan:vars>
20 i=0;
21 int k = 0;
22 int result = 0;
23
24 #pragma omp parallel
25 {
26 #pragma omp single
27 for (k = 0; k < NUM_TASKS; k++)
28 {
29 <ompts:orphan>
30 #pragma omp task <ompts:crosscheck> firstprivate(i) </ompts:crosscheck> <ompts:check> shared(i)</ompts:check>
31 {
32 #pragma omp atomic
33 i++;
34 //this should be shared implicitly
35
36 }
37 </ompts:orphan>
38 }
39
40 }
41
42result = i;
43return ((result == NUM_TASKS));
44
45}
46</ompts:testcode>
47</ompts:test>