diff options
author | Hans Wennborg <hans@hanshq.net> | 2019-03-18 12:53:32 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2019-03-18 12:53:32 +0000 |
commit | abdd46b7db373cb68b58d543400ceb178347b056 (patch) | |
tree | 04720549cebf68f6bd10f0009d01c340d7a65c9f /final/libomptarget/test/offloading/offloading_success.c | |
parent | 001d07557b8ffbecdb4f51536c1115f9bcba5ef1 (diff) |
Creating release candidate final from release_800 branchsvn-tags/RELEASE_800
git-svn-id: https://llvm.org/svn/llvm-project/openmp/tags/RELEASE_800@356365 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'final/libomptarget/test/offloading/offloading_success.c')
-rw-r--r-- | final/libomptarget/test/offloading/offloading_success.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/final/libomptarget/test/offloading/offloading_success.c b/final/libomptarget/test/offloading/offloading_success.c new file mode 100644 index 0000000..12e78fa --- /dev/null +++ b/final/libomptarget/test/offloading/offloading_success.c @@ -0,0 +1,23 @@ +// RUN: %libomptarget-compile-run-and-check-aarch64-unknown-linux-gnu +// RUN: %libomptarget-compile-run-and-check-powerpc64-ibm-linux-gnu +// RUN: %libomptarget-compile-run-and-check-powerpc64le-ibm-linux-gnu +// RUN: %libomptarget-compile-run-and-check-x86_64-pc-linux-gnu + +#include <stdio.h> +#include <omp.h> + +int main(void) { + int isHost = -1; + +#pragma omp target map(from: isHost) + { isHost = omp_is_initial_device(); } + + if (isHost < 0) { + printf("Runtime error, isHost=%d\n", isHost); + } + + // CHECK: Target region executed on the device + printf("Target region executed on the %s\n", isHost ? "host" : "device"); + + return isHost; +} |