1 // RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu 2 // 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 // RUN: %libomptarget-compilexx-run-and-check-nvptx64-nvidia-cuda 6 7 #include <stdio.h> 8 #include <omp.h> 9 10 int main(void) { 11 int isHost = 0; 12 13 #pragma omp target map(from: isHost) 14 { isHost = omp_is_initial_device(); } 15 16 if (isHost < 0) { 17 printf("Runtime error, isHost=%d\n", isHost); 18 } 19 20 // CHECK: Target region executed on the device 21 printf("Target region executed on the %s\n", isHost ? "host" : "device"); 22 23 return isHost; 24 } 25