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