1 | // clang-format off |
---|---|
2 | // RUN: %libomptarget-compilexx-generic && env LIBOMPTARGET_REUSE_BLOCKS_FOR_HIGH_TRIP_COUNT=False %libomptarget-run-generic 2>&1 | %fcheck-generic |
3 | // RUN: %libomptarget-compilexx-generic && %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=DEFAULT |
4 | |
5 | // UNSUPPORTED: aarch64-unknown-linux-gnu |
6 | // UNSUPPORTED: aarch64-unknown-linux-gnu-LTO |
7 | // UNSUPPORTED: x86_64-unknown-linux-gnu |
8 | // UNSUPPORTED: x86_64-unknown-linux-gnu-LTO |
9 | // UNSUPPORTED: s390x-ibm-linux-gnu |
10 | // UNSUPPORTED: s390x-ibm-linux-gnu-LTO |
11 | // clang-format on |
12 | |
13 | /* |
14 | Check if there is a thread for each loop iteration |
15 | */ |
16 | #include <omp.h> |
17 | #include <stdio.h> |
18 | |
19 | int main() { |
20 | int N = 819200; |
21 | int num_threads[N]; |
22 | |
23 | #pragma omp target teams distribute parallel for |
24 | for (int j = 0; j < N; j++) { |
25 | num_threads[j] = omp_get_num_threads() * omp_get_num_teams(); |
26 | } |
27 | |
28 | if (num_threads[0] == N) |
29 | // CHECK: PASS |
30 | printf(format: "PASS\n"); |
31 | else |
32 | // DEFAULT: FAIL |
33 | printf(format: "FAIL: num_threads: %d\n != N: %d", num_threads[0], N); |
34 | return 0; |
35 | } |
36 |