diff options
author | George Rokos <grokos@us.ibm.com> | 2017-01-25 21:27:24 +0000 |
---|---|---|
committer | George Rokos <grokos@us.ibm.com> | 2017-01-25 21:27:24 +0000 |
commit | 2467df6e4f04e3d0e8e78d662473ba1b87c0a885 (patch) | |
tree | 4edaff3644109115394f27b5ecf914436b650aab /openmp/libomptarget/test/offloading/offloading_success.cpp | |
parent | c0fc25307143dd06c12fb2f5ebdb1dade7290ccf (diff) | |
download | bcm5719-llvm-2467df6e4f04e3d0e8e78d662473ba1b87c0a885.tar.gz bcm5719-llvm-2467df6e4f04e3d0e8e78d662473ba1b87c0a885.zip |
[OpenMP] Initial implementation of OpenMP offloading library - libomptarget.
This is the patch upstreaming the device-agnostic part of libomptarget.
Differential Revision: https://reviews.llvm.org/D14031
llvm-svn: 293094
Diffstat (limited to 'openmp/libomptarget/test/offloading/offloading_success.cpp')
-rw-r--r-- | openmp/libomptarget/test/offloading/offloading_success.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/openmp/libomptarget/test/offloading/offloading_success.cpp b/openmp/libomptarget/test/offloading/offloading_success.cpp new file mode 100644 index 00000000000..62d5cf8758f --- /dev/null +++ b/openmp/libomptarget/test/offloading/offloading_success.cpp @@ -0,0 +1,22 @@ +// RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu +// RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu +// RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu + +#include <stdio.h> +#include <omp.h> + +int main(void) { + int isHost = 0; + +#pragma omp target + { 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; +} |