-
Notifications
You must be signed in to change notification settings - Fork 15
/
serial_loop_gang_blocking.F90
71 lines (64 loc) · 1.67 KB
/
serial_loop_gang_blocking.F90
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef T1
!T1:loop,V:2.6-2.7
LOGICAL FUNCTION test1()
IMPLICIT NONE
INCLUDE "acc_testsuite.Fh"
REAL(8),DIMENSION(LOOPCOUNT):: a, b, c
INTEGER:: multiplier
INTEGER:: x
INTEGER:: errors
errors = 0
SEEDDIM(1) = 1
# ifdef SEED
SEEDDIM(1) = SEED
# endif
CALL RANDOM_SEED(PUT=SEEDDIM)
CALL RANDOM_NUMBER(a)
CALL RANDOM_NUMBER(b)
c = 0
!$acc data copyin(a(1:LOOPCOUNT), b(1:LOOPCOUNT)) copyout(c(1:LOOPCOUNT))
!$acc serial
!$acc loop gang
DO x = 1, LOOPCOUNT
c(x) = (a(x) + b(x)) * multiplier
END DO
multiplier = multiplier + 1
!$acc loop gang
DO x = 1, LOOPCOUNT
c(x) = c(x) + ((a(x) + b(x)) * multiplier)
END DO
!$acc end serial
!$acc end data
DO x = 1, LOOPCOUNT
IF (abs(c(x) - (3 * (a(x) + b(x)))) .gt. PRECISION) THEN
errors = errors + 1
END IF
END DO
IF (errors .eq. 0) THEN
test1 = .FALSE.
ELSE
test1 = .TRUE.
END IF
END
#endif
PROGRAM main
IMPLICIT NONE
INTEGER :: failcode, testrun
LOGICAL :: failed
INCLUDE "acc_testsuite.Fh"
#ifndef T1
LOGICAL :: test1
#endif
failed = .FALSE.
failcode = 0
#ifndef T1
DO testrun = 1, NUM_TEST_CALLS
failed = failed .or. test1()
END DO
IF (failed) THEN
failcode = failcode + 2 ** 0
failed = .FALSE.
END IF
#endif
CALL EXIT (failcode)
END PROGRAM