-
Notifications
You must be signed in to change notification settings - Fork 16
/
set_device_type_num.F90
109 lines (101 loc) · 2.65 KB
/
set_device_type_num.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef T1
!T1:runtime,construct-independent,internal-control-values,set,nonvalidating,V:2.5-3.2
LOGICAL FUNCTION test1()
USE OPENACC
IMPLICIT NONE
INCLUDE "acc_testsuite.Fh"
INTEGER :: device_type
INTEGER :: errors = 0
device_type = acc_get_device_type()
device_num = acc_get_device_num(device_type)
!$acc set device_type(host)
IF (errors .eq. 0) THEN
test1 = .FALSE.
ELSE
test1 = .TRUE.
END IF
END
#endif
#ifndef T2
!T2:runtime,construct-independent,internal-control-values,set,nonvalidating,V:2.5-3.2
LOGICAL FUNCTION test2()
USE OPENACC
IMPLICIT NONE
INCLUDE "acc_testsuite.Fh"
INTEGER :: device_num
INTEGER :: device_type
INTEGER :: errors = 0
device_type = acc_get_device_type()
device_num = acc_get_device_num(device_type)
!$acc set device_type(multicore) device_num(device_num)
IF (errors .eq. 0) THEN
test2 = .FALSE.
ELSE
test2 = .TRUE.
END IF
END
#endif
#ifndef T3
!T3:runtime,construct-independent,internal-control-values,set,nonvalidating,V:2.5-3.2
LOGICAL FUNCTION test3()
USE OPENACC
IMPLICIT NONE
INCLUDE "acc_testsuite.Fh"
INTEGER :: device_num
INTEGER :: device_type
INTEGER :: errors = 0
device_type = acc_get_device_type()
device_num = acc_get_device_num(device_type)
!$acc set device_type(default) device_num(device_num)
IF (errors .eq. 0) THEN
test3 = .FALSE.
ELSE
test3 = .TRUE.
END IF
END
#endif
PROGRAM main
IMPLICIT NONE
INTEGER :: failcode, testrun
LOGICAL :: failed
INCLUDE "acc_testsuite.Fh"
#ifndef T1
LOGICAL :: test1
#endif
#ifndef T2
LOGICAL :: test2
#endif
#ifndef T3
LOGICAL :: test3
#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
#ifndef T2
DO testrun = 1, NUM_TEST_CALLS
failed = failed .or. test2()
END DO
IF (failed) THEN
failcode = failcode + 2 ** 1
failed = .FALSE.
END IF
#endif
#ifndef T3
DO testrun = 1, NUM_TEST_CALLS
failed = failed .or. test3()
END DO
IF (failed) THEN
failcode = failcode + 2 ** 2
failed = .FALSE.
END IF
#endif
CALL EXIT (failcode)
END PROGRAM