1 // RUN: %libomptarget-compile-run-and-check-generic
6 // Allocate pinned memory on the host
7 void *llvm_omp_target_alloc_host(size_t, int);
8 void llvm_omp_target_free_host(void *, int);
12 const int device
= omp_get_default_device();
13 const int host
= omp_get_initial_device();
15 int *hst_ptr
= llvm_omp_target_alloc_host(N
* sizeof(int), device
);
17 for (int i
= 0; i
< N
; ++i
)
20 #pragma omp target teams distribute parallel for device(device) \
21 map(tofrom : hst_ptr[0 : N])
22 for (int i
= 0; i
< N
; ++i
)
26 for (int i
= 0; i
< N
; ++i
)
29 llvm_omp_target_free_host(hst_ptr
, device
);