Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / api / omp_host_pinned_memory_alloc.c
blobfa3e2455d3714c741f1199493ae3c53154f6d58d
1 // RUN: %libomptarget-compile-run-and-check-generic
3 #include <omp.h>
4 #include <stdio.h>
6 int main() {
7 const int N = 64;
9 int *hst_ptr = omp_alloc(N * sizeof(int), llvm_omp_target_host_mem_alloc);
11 for (int i = 0; i < N; ++i)
12 hst_ptr[i] = 2;
14 #pragma omp target teams distribute parallel for map(tofrom : hst_ptr[0 : N])
15 for (int i = 0; i < N; ++i)
16 hst_ptr[i] -= 1;
18 int sum = 0;
19 for (int i = 0; i < N; ++i)
20 sum += hst_ptr[i];
22 omp_free(hst_ptr, llvm_omp_target_host_mem_alloc);
23 // CHECK: PASS
24 if (sum == N)
25 printf("PASS\n");