1 // RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
2 // RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
3 // RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
4 
5 #include <stdio.h>
6 #include <omp.h>
7 
8 int main(void) {
9   int isHost = 0;
10 
11 #pragma omp target
12   { isHost = omp_is_initial_device(); }
13 
14   if (isHost < 0) {
15     printf("Runtime error, isHost=%d\n", isHost);
16   }
17 
18   // CHECK: Target region executed on the device
19   printf("Target region executed on the %s\n", isHost ? "host" : "device");
20 
21   return isHost;
22 }
23