blob: 84045dbe32801ecbbaaff51ff3e914aec26d9386 (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/* { dg-do run } */
#include <stdlib.h>
#include <openacc.h>
int
main (int argc, char **argv)
{
int i;
int num_devices;
int devnum;
acc_device_t devtype = acc_device_host;
#if ACC_DEVICE_TYPE_nvidia
devtype = acc_device_nvidia;
#endif
num_devices = acc_get_num_devices (devtype);
if (num_devices == 0)
return 0;
acc_init (devtype);
for (i = 0; i < num_devices; i++)
{
acc_set_device_num (i, devtype);
devnum = acc_get_device_num (devtype);
if (devnum != i)
abort ();
}
acc_shutdown (devtype);
num_devices = acc_get_num_devices (devtype);
if (num_devices == 0)
abort ();
for (i = 0; i < num_devices; i++)
{
acc_set_device_num (i, devtype);
devnum = acc_get_device_num (devtype);
if (devnum != i)
abort ();
}
acc_shutdown (devtype);
acc_init (devtype);
acc_set_device_num (0, devtype);
devnum = acc_get_device_num (devtype);
if (devnum != 0)
abort ();
if (num_devices > 1)
{
acc_set_device_num (1, (acc_device_t) 0);
devnum = acc_get_device_num (devtype);
if (devnum != 0)
abort ();
}
acc_shutdown (devtype);
return 0;
}
/* { dg-output "" } */
|