blob: 5b053026df3cbcaf30391408db62cc5253994191 [file] [log] [blame]
Paul Osmialowski1e254c52017-03-06 21:00:07 +00001// RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu
George Rokos2467df62017-01-25 21:27:24 +00002// RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
3// RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
4// RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
5
6#include <stdio.h>
7#include <omp.h>
8
9int main(void) {
10 int isHost = 0;
11
12#pragma omp target
13 { isHost = omp_is_initial_device(); }
14
15 if (isHost < 0) {
16 printf("Runtime error, isHost=%d\n", isHost);
17 }
18
19 // CHECK: Target region executed on the device
20 printf("Target region executed on the %s\n", isHost ? "host" : "device");
21
22 return isHost;
23}