1 // RUN: %libomptarget-compilexx-run-and-check-generic
3 // UNSUPPORTED: amdgcn-amd-amdhsa
4 // UNSUPPORTED: x86_64-pc-linux-gnu
5 // UNSUPPORTED: x86_64-pc-linux-gnu-LTO
12 int main(int argc
, char *argv
[]) {
13 #pragma omp parallel for
14 for (int i
= 0; i
< 16; ++i
) {
15 for (int n
= 1; n
< (1 << 13); n
<<= 1) {
16 void *p
= omp_target_alloc(n
* sizeof(int), 0);
17 omp_target_free(p
, 0);
21 #pragma omp parallel for
22 for (int i
= 0; i
< 16; ++i
) {
23 for (int n
= 1; n
< (1 << 13); n
<<= 1) {
24 int *p
= (int *)omp_target_alloc(n
* sizeof(int), 0);
25 #pragma omp target teams distribute parallel for is_device_ptr(p)
26 for (int j
= 0; j
< n
; ++j
) {
30 #pragma omp target teams distribute parallel for is_device_ptr(p) \
32 for (int j
= 0; j
< n
; ++j
) {
35 for (int j
= 0; j
< n
; ++j
) {
36 assert(buffer
[j
] == i
);
38 omp_target_free(p
, 0);
42 std::cout
<< "PASS\n";