[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / openmp / runtime / test / api / omp_pinned.c
blob31ad6898beaad0cb7a568dceeacaeead3ffb4b07
1 // RUN: %libomp-compile-and-run
2 // RUN: env OMP_ALLOCATOR=omp_default_mem_space:pinned=true %libomp-run
4 #include <omp.h>
6 int main() {
7 omp_alloctrait_t pinned_trait[1] = {{omp_atk_pinned, omp_atv_true}};
8 omp_allocator_handle_t pinned_alloc =
9 omp_init_allocator(omp_default_mem_space, 1, pinned_trait);
10 omp_allocator_handle_t default_alloc = omp_get_default_allocator();
11 double *a = (double *)omp_alloc(10 * sizeof(double), pinned_alloc);
12 double *b = (double *)omp_alloc(10 * sizeof(double), default_alloc);
14 if (!a || !b) return 1;
16 #pragma omp parallel for
17 for (int i = 0; i < 10; i++) {
18 a[i] = 0;
19 b[i] = 1;
22 for (int i = 0; i < 10; i++)
23 if (a[i] != 0 || b[i] != 1) return 1;
25 omp_free(a, pinned_alloc);
26 omp_free(b, default_alloc);
28 return 0;