libgomp testsuite: OpenACC C++ testing.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-6.c
blobafdd480cb7164a4480a7042b32152ccdd2eec03f
1 /* { dg-do run } */
3 #include <stdlib.h>
4 #include <openacc.h>
6 int
7 main (int argc, char **argv)
9 int devnum;
11 if (acc_get_device_type () == acc_device_default)
12 abort ();
14 if (acc_get_num_devices (acc_device_nvidia) == 0)
15 return 0;
17 acc_set_device_type (acc_device_nvidia);
19 if (acc_get_device_type () != acc_device_nvidia)
20 abort ();
22 acc_shutdown (acc_device_nvidia);
24 acc_set_device_type (acc_device_nvidia);
26 if (acc_get_device_type () != acc_device_nvidia)
27 abort ();
29 devnum = acc_get_num_devices (acc_device_host);
30 if (devnum != 1)
31 abort ();
33 acc_shutdown (acc_device_nvidia);
35 if (acc_get_device_type () == acc_device_default)
36 abort ();
38 return 0;