-
Notifications
You must be signed in to change notification settings - Fork 15
/
set_device_type.c
79 lines (69 loc) · 1.42 KB
/
set_device_type.c
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
#include "acc_testsuite.h"
#ifndef T1
//T1:set,runtime,syntactic,V:2.5-3.2
int test1(){
int err = 0;
int device_type = acc_get_device_type();
#pragma acc set device_type(host)
if (acc_get_device_type() != device_type){
err += 1;
}
return err;
}
#endif
#ifndef T2
//T2:set,runtime,syntactic,V:2.5-3.2
int test2(){
int err = 0;
int device_type = acc_get_device_type();
#pragma acc set device_type(multicore)
if (acc_get_device_type() != device_type){
err += 1;
}
return err;
}
#endif
#ifndef T3
//T3:set,runtime,syntactic,V:2.5-3.2
int test3(){
int err = 0;
int device_type = acc_get_device_type();
#pragma acc set device_type(default)
if (acc_get_device_type() != device_type){
err += 1;
}
return err;
}
#endif
int main(){
int failcode = 0;
int failed;
#ifndef T1
failed = 0;
for (int x = 0; x < NUM_TEST_CALLS; ++x){
failed = failed + test1();
}
if (failed != 0){
failcode = failcode + (1 << 0);
}
#endif
#ifndef T2
failed = 0;
for (int x = 0; x < NUM_TEST_CALLS; ++x){
failed = failed + test2();
}
if (failed != 0){
failcode = failcode + (1 << 1);
}
#endif
#ifndef T3
failed = 0;
for (int x = 0; x < NUM_TEST_CALLS; ++x){
failed = failed + test3();
}
if (failed != 0){
failcode = failcode + (1 << 2);
}
#endif
return failcode;
}