Jim Cownie | 18d8473 | 2014-05-10 17:02:09 +0000 | [diff] [blame] | 1 | <ompts:test> |
| 2 | <ompts:testdescription>Test which checks the omp single private directive.</ompts:testdescription> |
| 3 | <ompts:ompversion>2.0</ompts:ompversion> |
| 4 | <ompts:directive>omp singel private</ompts:directive> |
| 5 | <ompts:dependences>omp critical,omp flush,omp single nowait</ompts:dependences> |
| 6 | <ompts:testcode> |
| 7 | INTEGER FUNCTION <ompts:testcode:functionname>single_private</ompts:testcode:functionname>() |
| 8 | IMPLICIT NONE |
| 9 | INTEGER nr_iterations, i |
| 10 | <ompts:orphan:vars> |
| 11 | INTEGER result |
| 12 | INTEGER nr_threads_in_single, myresult, myit |
| 13 | COMMON /orphvars/ result,nr_iterations |
| 14 | </ompts:orphan:vars> |
| 15 | INCLUDE "omp_testsuite.f" |
| 16 | nr_threads_in_single=0 |
| 17 | result=0 |
| 18 | myresult=0 |
| 19 | myit=0 |
| 20 | nr_iterations=0 |
| 21 | !$omp parallel private(i, myresult, myit) |
| 22 | <ompts:orphan> |
| 23 | myresult = 0 |
| 24 | myit = 0 |
| 25 | nr_threads_in_single=0 |
| 26 | !$omp barrier |
| 27 | DO i=0, LOOPCOUNT -1 |
| 28 | !$omp single <ompts:check>private(nr_threads_in_single)</ompts:check> |
| 29 | nr_threads_in_single = 0 |
| 30 | !$omp flush |
| 31 | nr_threads_in_single = nr_threads_in_single + 1 |
| 32 | !$omp flush |
| 33 | myit = myit + 1 |
| 34 | myresult = myresult + nr_threads_in_single |
| 35 | !$omp end single nowait |
| 36 | END DO |
| 37 | !$omp critical |
| 38 | result = result + nr_threads_in_single |
| 39 | nr_iterations = nr_iterations + myit |
| 40 | !$omp end critical |
| 41 | </ompts:orphan> |
| 42 | !$omp end parallel |
| 43 | WRITE(1,*) "result is",result,"nr_it is",nr_iterations |
| 44 | IF ( result .EQ. 0 .AND. nr_iterations .EQ. LOOPCOUNT) THEN |
| 45 | <testfunctionname></testfunctionname> = 1 |
| 46 | ELSE |
| 47 | <testfunctionname></testfunctionname> = 0 |
| 48 | END IF |
| 49 | END |
| 50 | </ompts:testcode> |
| 51 | </ompts:test> |