1 // RUN: %libomptarget-compilexx-run-and-check-generic
12 for (int i
= 0; i
< N
; i
++)
15 #pragma omp parallel num_threads(2)
17 if (omp_get_thread_num() == 1) {
18 // map data A & B and move to
19 #pragma omp target enter data map(to : A, B) depend(out : A[0]) nowait
21 // no data move since already mapped
22 #pragma omp target map(A, B) depend(out : A[0]) nowait
24 for (int i
= 0; i
< N
; i
++)
26 for (int i
= 0; i
< N
; i
++)
30 // no data move since already mapped
31 #pragma omp target teams num_teams(1) map(A, B) depend(out : A[0]) nowait
33 for (int i
= 0; i
< N
; i
++)
35 for (int i
= 0; i
< N
; i
++)
39 // A updated via update
40 #pragma omp target update from(A) depend(out : A[0]) nowait
42 // B updated via exit, A just released
43 #pragma omp target exit data map(release : A) map(from : B) depend(out : A[0]) \
49 for (int i
= 0; i
< N
; i
++)
51 // Sum is 2 * N * (2 + N - 1 + 2) / 2
52 // CHECK: Sum = 1051648.
53 printf("Sum = %d.\n", Sum
);
55 return Sum
!= 2 * N
* (2 + N
- 1 + 2) / 2;