Jim Cownie | 18d8473 | 2014-05-10 17:02:09 +0000 | [diff] [blame] | 1 | <ompts:test> |
| 2 | <ompts:testdescription> Test to see if implied private works properly</ompts:testdescription> |
| 3 | <ompts:ompversion>3.0</ompts:ompversion> |
| 4 | <ompts:directive>omp task</ompts:directive> |
| 5 | <ompts:dependences>omp single</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_firstprivate</ompts:testcode:functionname> (FILE * logFile) |
| 16 | { |
| 17 | int i=5; |
| 18 | int k = 0; |
| 19 | int result = 0; |
| 20 | int task_result = 1; |
| 21 | #pragma omp parallel firstprivate(i) |
| 22 | { |
| 23 | #pragma omp single |
| 24 | { |
| 25 | |
| 26 | |
| 27 | for (k = 0; k < NUM_TASKS; k++) |
| 28 | { |
| 29 | #pragma omp task shared(result , task_result<ompts:crosscheck>, i</ompts:crosscheck>) |
| 30 | { |
| 31 | int j; |
| 32 | //check if i is private |
| 33 | if(i != 5) |
| 34 | task_result = 0; |
| 35 | |
| 36 | for(j = 0; j < NUM_TASKS; j++) |
| 37 | i++; |
| 38 | //this should be firstprivate implicitly |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | #pragma omp taskwait |
| 43 | result = (task_result && i==5); |
| 44 | } |
| 45 | |
| 46 | } |
| 47 | |
| 48 | return result; |
| 49 | } |
| 50 | </ompts:testcode> |
| 51 | </ompts:test> |