[Instrumentation] Fix a warning
[llvm-project.git] / openmp / runtime / test / worksharing / for / omp_nonmonotonic_nowait.c
blob47ea1150b7f35c91e0949c0fc3291797a5870d5e
1 // RUN: %libomp-compile-and-run
3 // The test checks nonmonotonic scheduling works correctly when threads
4 // may execute different loops concurrently.
6 #include <stdio.h>
7 #include <omp.h>
9 #define N 200
10 #define C 20
11 int main()
13 int i, l0 = 0, l1 = 0;
14 #pragma omp parallel num_threads(8)
16 #pragma omp for schedule(nonmonotonic:dynamic,C) nowait
17 for (i = 0; i < N; ++i) {
18 #pragma omp atomic
19 l0++;
21 #pragma omp for schedule(nonmonotonic:dynamic,C) nowait
22 for (i = 0; i < N * N; ++i) {
23 #pragma omp atomic
24 l1++;
27 if (l0 != N || l1 != N * N) {
28 printf("failed l0 = %d, l1 = %d, should be %d %d\n", l0, l1, N, N * N);
29 return 1;
30 } else {
31 printf("passed\n");
32 return 0;