Update 'Q' constraint documentation.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-9.c
blob5dce9b820880f12386b98535a2a9ae074623f781
1 /* { dg-do run } */
3 #include <stdlib.h>
4 #include <openacc.h>
6 int
7 main (int argc, char **argv)
9 int i;
10 int num_devices;
11 int devnum;
12 acc_device_t devtype = acc_device_default;
14 num_devices = acc_get_num_devices (devtype);
15 if (num_devices == 0)
16 abort ();
18 acc_init (devtype);
20 if (num_devices != acc_get_num_devices (devtype))
21 abort ();
23 for (i = 0; i < num_devices; i++)
25 acc_set_device_num (i, devtype);
26 devnum = acc_get_device_num (devtype);
27 if (devnum != i)
28 abort ();
31 acc_shutdown (devtype);
33 if (num_devices != acc_get_num_devices (devtype))
34 abort ();
36 for (i = 0; i < num_devices; i++)
38 acc_set_device_num (i, devtype);
39 devnum = acc_get_device_num (devtype);
40 if (devnum != i)
41 abort ();
44 acc_shutdown (devtype);
46 acc_init (devtype);
48 acc_set_device_num (0, devtype);
50 devnum = acc_get_device_num (devtype);
51 if (devnum != 0)
52 abort ();
54 if (num_devices > 1)
56 acc_set_device_num (1, (acc_device_t) 0);
58 devnum = acc_get_device_num (devtype);
59 if (devnum != 1)
60 abort ();
63 acc_shutdown (devtype);
65 return 0;
68 /* { dg-output "" } */