1 // RUN: %libomptarget-compile-generic
2 // RUN: %libomptarget-run-generic 2>&1 \
3 // RUN: | %fcheck-generic
13 float *A
= (float *)malloc(N
* sizeof(float));
14 float *B
= (float *)malloc(N
* sizeof(float));
15 float *C
= (float *)malloc(N
* sizeof(float));
17 for (int i
= 0; i
< N
; i
++) {
21 for (int i
= 0; i
< N
; i
++) {
26 #pragma omp target enter data map(to : A[FROM : LENGTH], B[FROM : LENGTH])
27 #pragma omp target enter data map(alloc : C[FROM : LENGTH])
29 // A, B and C have been mapped starting at index FROM, but inside the kernel
30 // they are captured implicitly so the library must look them up using their
34 for (int i
= FROM
; i
< FROM
+ LENGTH
; i
++) {
39 #pragma omp target exit data map(from : C[FROM : LENGTH])
40 #pragma omp target exit data map(delete : A[FROM : LENGTH], B[FROM : LENGTH])
43 for (int i
= FROM
; i
< FROM
+ LENGTH
; i
++)
44 if (C
[i
] != A
[i
] + B
[i
])
49 fprintf(stderr
, "Failure\n");
51 fprintf(stderr
, "Success\n");