1 // RUN: %libomptarget-compilexx-generic -fopenmp-version=51
2 // RUN: %libomptarget-run-generic 2>&1 \
3 // RUN: | %fcheck-generic
14 std::size_t bytes
= size
* sizeof(int);
15 const int host_id
= omp_get_initial_device();
16 const int device_id
= omp_get_default_device();
17 data_host
= (int *)malloc(bytes
);
18 data_device
= (int *)omp_target_alloc(bytes
, device_id
);
19 #pragma omp target teams distribute parallel for has_device_addr(data_device[0])
20 for (int i
= 0; i
< size
; ++i
)
22 omp_target_memcpy(data_host
, data_device
, bytes
, 0, 0, host_id
, device_id
);
23 for (int i
= 0; i
< size
; ++i
)
24 assert(data_host
[i
] == i
);