1 // RUN: %libomp-compile
2 // RUN: env OMP_SCHEDULE=nonmonotonic:dynamic,10 %libomp-run
4 // The test checks iterations distribution for OMP 5.0 nonmonotonic OMP_SCHEDULE
5 // case #threads > #chunks (fallback to monotonic dynamic)
14 int main(int argc
, char **argv
) {
16 omp_set_num_threads(16); // #threads is bigger than #chunks
17 #pragma omp parallel for schedule(runtime)
18 for (i
= 0; i
< ITERS
; ++i
) {
19 it
[i
] = omp_get_thread_num();
21 // check that each chunk executed by single thread
22 for (ch
= 0; ch
< ITERS
/CHUNK
; ++ch
) {
23 int iter
= ch
* CHUNK
;
24 int nt
= it
[iter
]; // thread number
25 for (i
= 1; i
< CHUNK
; ++i
) {
27 printf("iter %d: (%d %d)\n", iter
+ i
, nt
, it
[iter
+ i
]);
29 if (nt
!= it
[iter
+ i
]) {
35 printf("Failed, err = %d\n", err
);