ubuntu-buildroot/output/build/host-gcc-final-11.4.0/libgomp/testsuite/libgomp.c/examples-4/device-2.c

30 lines
503 B
C
Raw Normal View History

2024-04-01 15:19:46 +00:00
/* { dg-do run } */
/* { dg-require-effective-target offload_device } */
#include <omp.h>
#include <stdlib.h>
#define N 10
int main ()
{
int i;
int offload[N];
int num = omp_get_num_devices();
#pragma omp parallel for
for (i = 0; i < N; i++)
#pragma omp target device(i) map(from: offload[i:1])
offload[i] = omp_is_initial_device ();
for (i = 0; i < num; i++)
if (offload[i])
abort ();
for (i = num; i < N; i++)
if (!offload[i])
abort ();
return 0;
}