Jim Cownie | 18d8473 | 2014-05-10 17:02:09 +0000 | [diff] [blame] | 1 | <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 */ |
| 15 | int <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 | |
| 42 | result = i; |
| 43 | return ((result == NUM_TASKS)); |
| 44 | |
| 45 | } |
| 46 | </ompts:testcode> |
| 47 | </ompts:test> |