summaryrefslogtreecommitdiff
path: root/offload/test/offloading/offloading_success.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'offload/test/offloading/offloading_success.cpp')
-rw-r--r--offload/test/offloading/offloading_success.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/offload/test/offloading/offloading_success.cpp b/offload/test/offloading/offloading_success.cpp
new file mode 100644
index 000000000000..d3103b8666ab
--- /dev/null
+++ b/offload/test/offloading/offloading_success.cpp
@@ -0,0 +1,20 @@
+// RUN: %libomptarget-compilexx-run-and-check-generic
+
+#include <omp.h>
+#include <stdio.h>
+
+int main(void) {
+ int isHost = 0;
+
+#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;
+}