Retro68/gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-9.c

69 lines
1.2 KiB
C
Raw Normal View History

2015-08-28 15:33:40 +00:00
/* { dg-do run } */
#include <stdlib.h>
#include <openacc.h>
int
main (int argc, char **argv)
{
int i;
int num_devices;
int devnum;
2017-04-10 11:32:00 +00:00
acc_device_t devtype = acc_device_default;
2015-08-28 15:33:40 +00:00
num_devices = acc_get_num_devices (devtype);
if (num_devices == 0)
2017-04-10 11:32:00 +00:00
abort ();
2015-08-28 15:33:40 +00:00
acc_init (devtype);
2017-04-10 11:32:00 +00:00
if (num_devices != acc_get_num_devices (devtype))
abort ();
2015-08-28 15:33:40 +00:00
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);
2017-04-10 11:32:00 +00:00
if (num_devices != acc_get_num_devices (devtype))
2015-08-28 15:33:40 +00:00
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 != 1)
abort ();
}
acc_shutdown (devtype);
return 0;
}
/* { dg-output "" } */