Jim Cownie | 18d8473 | 2014-05-10 17:02:09 +0000 | [diff] [blame^] | 1 | <ompts:test> |
| 2 | <ompts:testdescription>Test which checks the omp section firstprivate directive by adding a variable which is defined before the parallel region.</ompts:testdescription> |
| 3 | <ompts:ompversion>2.0</ompts:ompversion> |
| 4 | <ompts:directive>omp firstprivate</ompts:directive> |
| 5 | <ompts:testcode> |
| 6 | INTEGER FUNCTION <ompts:testcode:functionname>section_firstprivate</ompts:testcode:functionname>() |
| 7 | IMPLICIT NONE |
| 8 | INTEGER known_sum |
| 9 | <ompts:orphan:vars> |
| 10 | INTEGER sum,sum0 |
| 11 | COMMON /orphvars/ sum,sum0 |
| 12 | </ompts:orphan:vars> |
| 13 | sum = 7 |
| 14 | sum0 = 11 |
| 15 | !$omp parallel |
| 16 | <ompts:orphan> |
| 17 | !$omp sections <ompts:check>firstprivate(sum0)</ompts:check><ompts:crosscheck>private(sum0)</ompts:crosscheck> |
| 18 | !$omp section |
| 19 | !$omp critical |
| 20 | sum = sum + sum0 |
| 21 | !$omp end critical |
| 22 | !$omp section |
| 23 | !$omp critical |
| 24 | sum = sum + sum0 |
| 25 | !$omp end critical |
| 26 | !$omp section |
| 27 | !$omp critical |
| 28 | sum = sum + sum0 |
| 29 | !$omp end critical |
| 30 | !$omp end sections |
| 31 | </ompts:orphan> |
| 32 | !$omp end parallel |
| 33 | known_sum = 11*3+7 |
| 34 | IF ( known_sum .EQ. sum) THEN |
| 35 | <testfunctionname></testfunctionname> = 1 |
| 36 | ELSE |
| 37 | <testfunctionname></testfunctionname> = 0 |
| 38 | END IF |
| 39 | END |
| 40 | </ompts:testcode> |
| 41 | </ompts:test> |