Paul Osmialowski | 1e254c5 | 2017-03-06 21:00:07 +0000 | [diff] [blame^] | 1 | // RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu |
George Rokos | 2467df6 | 2017-01-25 21:27:24 +0000 | [diff] [blame] | 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 | |
| 6 | #include <stdio.h> |
| 7 | #include <omp.h> |
| 8 | |
| 9 | int 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 | } |