blob: 714f149a925666812c05f52122a4b6658aa45d4a [file] [log] [blame]
Jim Cownie18d84732014-05-10 17:02:09 +00001<ompts:test>
2<ompts:testdescription>Test which checks the omp parallel copyin directive.</ ompts:testdescription>
3<ompts:ompversion>2.0</ompts:ompversion>
4<ompts:directive>omp parallel copyin</ompts:directive>
5<ompts:dependences>omp critical,omp threadprivate</ompts:dependences>
6<ompts:testcode>
7! Changelog:
8 INTEGER FUNCTION <ompts:testcode:functionname>omp_copyin</ompts:testcode:functionname>()
9 IMPLICIT NONE
10 INTEGER known_sum
11 <ompts:orphan:vars>
12! INTEGER, SAVE::sum1
13! implicitly by omp_threadprivate, see spec25 Chap. 2.8.2
14 INTEGER sum1
15 COMMON /csum1/ sum1
16 INTEGER sum, i, threads
17 COMMON /orphvars/ sum, i, threads
18! C. Niethammer 30.11.06: moved threadprivate statement into the orphaned
19! function
20!$omp threadprivate(/csum1/)
21 </ompts:orphan:vars>
22
23 sum = 0
24 sum1 = 7
25 threads = 0
26 <ompts:orphan>
27!$omp parallel <ompts:check>copyin(sum1)</ompts:check>
28! print *,"sum1",sum1
29!$omp do
30 DO i=1, 999
31 sum1 = sum1 + i
32 END DO
33!$omp critical
34 sum = sum + sum1
35 threads = threads + 1
36!$omp end critical
37!$omp end parallel
38 </ompts:orphan>
39 known_sum = 999*1000/2 + 7*threads
40 IF ( known_sum .EQ. sum ) THEN
41 <testfunctionname></testfunctionname> = 1
42 ELSE
43 <testfunctionname></testfunctionname> = 0
44 END IF
45 END
46</ompts:testcode>
47</ompts:test>