1 // RUN: %libomptarget-compile-run-and-check-generic
13 #pragma omp declare mapper(id : C s) map(s.a[0 : NUM])
18 c
.a
= (int *)malloc(sizeof(int) * NUM
);
19 for (int i
= 0; i
< NUM
; i
++) {
22 #pragma omp target enter data map(mapper(id), alloc : c)
23 #pragma omp target teams distribute parallel for
24 for (int i
= 0; i
< NUM
; i
++) {
27 #pragma omp target update from(mapper(id) : c)
28 for (int i
= 0; i
< NUM
; i
++) {
31 // CHECK: Sum (after first update from) = 0
32 printf("Sum (after first update from) = %d\n", sum
);
33 for (int i
= 0; i
< NUM
; i
++) {
36 #pragma omp target update to(mapper(id) : c)
37 #pragma omp target teams distribute parallel for
38 for (int i
= 0; i
< NUM
; i
++) {
42 for (int i
= 0; i
< NUM
; i
++) {
45 // CHECK: Sum (after update to) = 1024
46 printf("Sum (after update to) = %d\n", sum
);
47 #pragma omp target update from(mapper(id) : c)
49 for (int i
= 0; i
< NUM
; i
++) {
52 // CHECK: Sum (after second update from) = 2048
53 printf("Sum (after second update from) = %d\n", sum
);
54 #pragma omp target exit data map(mapper(id), delete : c)