summaryrefslogtreecommitdiffstats
path: root/openmp/testsuite/fortran/omp_copyin.f
blob: 714f149a925666812c05f52122a4b6658aa45d4a (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
<ompts:test>
<ompts:testdescription>Test which checks the omp parallel copyin directive.</   ompts:testdescription>
<ompts:ompversion>2.0</ompts:ompversion>
<ompts:directive>omp parallel copyin</ompts:directive>
<ompts:dependences>omp critical,omp threadprivate</ompts:dependences>
<ompts:testcode>
! Changelog:
      INTEGER FUNCTION <ompts:testcode:functionname>omp_copyin</ompts:testcode:functionname>()
        IMPLICIT NONE
        INTEGER known_sum
		<ompts:orphan:vars>
!        INTEGER, SAVE::sum1 
!        implicitly by omp_threadprivate, see spec25 Chap. 2.8.2
        INTEGER sum1
        COMMON /csum1/ sum1
        INTEGER sum, i, threads
        COMMON /orphvars/ sum, i, threads
!   C. Niethammer 30.11.06: moved threadprivate statement into the orphaned
!      function
!$omp threadprivate(/csum1/)
		</ompts:orphan:vars>

        sum = 0
        sum1 = 7
        threads = 0
		<ompts:orphan>
!$omp parallel <ompts:check>copyin(sum1)</ompts:check>
!        print *,"sum1",sum1
!$omp do
        DO i=1, 999
          sum1 = sum1 + i
        END DO
!$omp critical
        sum = sum + sum1
        threads = threads + 1
!$omp end critical
!$omp end parallel
		</ompts:orphan>
        known_sum = 999*1000/2 + 7*threads
        IF ( known_sum .EQ. sum ) THEN
           <testfunctionname></testfunctionname> = 1
        ELSE
           <testfunctionname></testfunctionname> = 0
        END IF
      END
</ompts:testcode>
</ompts:test>
OpenPOWER on IntegriCloud