blob: 62d5cf8758f0bf9c5ab65cbfa6ba3283c326861c [file] [log] [blame]
George Rokos2467df62017-01-25 21:27:24 +00001// 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
8int 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}