Jim Cownie | 18d8473 | 2014-05-10 17:02:09 +0000 | [diff] [blame] | 1 | <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 "omp_my_sleep.f" |
| 8 | |
| 9 | INTEGER FUNCTION <ompts:testcode:functionname>omp_task_if</ompts:testcode:functionname>() |
| 10 | IMPLICIT NONE |
| 11 | INCLUDE "omp_testsuite.f" |
| 12 | <ompts:orphan:vars> |
| 13 | external my_sleep |
| 14 | INTEGER dummy |
| 15 | LOGICAL condition_false |
| 16 | INTEGER cnt |
| 17 | INTEGER rslt |
| 18 | COMMON /orphvars/ condition_false, cnt, rslt |
| 19 | </ompts:orphan:vars> |
| 20 | |
| 21 | cnt = 0 |
| 22 | condition_false = (dummy .eq. 314159) |
| 23 | |
| 24 | !$omp parallel |
| 25 | !$omp single |
| 26 | <ompts:orphan> |
| 27 | !$omp task <ompts:check>if (condition_false)</ompts:check> shared(cnt,rslt) |
| 28 | call my_sleep(SLEEPTIME_LONG) |
| 29 | !$omp flush |
| 30 | if (cnt .eq. 0) then |
| 31 | rslt = 1 |
| 32 | else |
| 33 | rslt = 0 |
| 34 | end if |
| 35 | !$omp end task |
| 36 | </ompts:orphan> |
| 37 | cnt = 1 |
| 38 | !$omp end single |
| 39 | !$omp end parallel |
| 40 | |
| 41 | <testfunctionname></testfunctionname> = rslt |
| 42 | |
| 43 | END FUNCTION |
| 44 | </ompts:testcode> |
| 45 | </ompts:test> |