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