1 | // clang-format off |
---|---|
2 | // RUN: %libomptarget-compilexx-generic |
3 | // RUN: env LIBOMPTARGET_INFO=16 \ |
4 | // RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic |
5 | |
6 | // REQUIRES: gpu |
7 | |
8 | int main(int argc, char *argv[]) { |
9 | constexpr const int block_size = 256; |
10 | constexpr const int grid_size = 4; |
11 | constexpr const int count = block_size * grid_size; |
12 | |
13 | int *data = new int[count]; |
14 | |
15 | #pragma omp target teams distribute parallel for thread_limit(block_size) map(from: data[0:count]) |
16 | for (int i = 0; i < count; ++i) |
17 | data[i] = i; |
18 | |
19 | for (int i = 0; i < count; ++i) |
20 | if (data[i] != i) |
21 | return 1; |
22 | |
23 | delete[] data; |
24 | |
25 | return 0; |
26 | } |
27 | |
28 | // CHECK: Launching kernel {{.*}} with [4,1,1] blocks and [256,1,1] threads in SPMD mode |
29 |