1// RUN: %libomptarget-compilexx-and-run-generic
2// RUN: %libomptarget-compileoptxx-and-run-generic
3
4#include <cassert>
5
6int main(int argc, char *argv[]) {
7 int data[1024];
8 int sum = 0;
9
10 for (int i = 0; i < 1024; ++i)
11 data[i] = i;
12
13#pragma omp target map(tofrom : sum) map(to : data) depend(inout : data[0]) \
14 nowait
15 {
16 for (int i = 0; i < 1024; ++i) {
17 sum += data[i];
18 }
19 }
20
21#pragma omp target map(tofrom : sum) map(to : data) depend(inout : data[0])
22 {
23 for (int i = 0; i < 1024; ++i) {
24 sum += data[i];
25 }
26 }
27
28 assert(sum == 1023 * 1024);
29
30 return 0;
31}
32

source code of offload/test/offloading/target_nowait_target.cpp