summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/examples-4/device-3.c
blob: af0865332785b1f7f8d459ef1096269516905548 (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
/* { dg-do run } */
/* { dg-require-effective-target offload_device } */

#include <omp.h>
#include <stdlib.h>

int main ()
{
  int res;
  int default_device = omp_get_default_device ();

  #pragma omp target map(from: res)
    res = omp_is_initial_device ();

  if (res)
    abort ();

  omp_set_default_device (omp_get_num_devices ());

  #pragma omp target map(from: res)
    res = omp_is_initial_device ();

  if (!res)
    abort ();

  return 0;
}