1 // RUN: %libomp-compile
2 // RUN: env KMP_DISP_NUM_BUFFERS=0 %libomp-run
3 // RUN: env KMP_DISP_NUM_BUFFERS=1 %libomp-run
4 // RUN: env KMP_DISP_NUM_BUFFERS=3 %libomp-run
5 // RUN: env KMP_DISP_NUM_BUFFERS=4 %libomp-run
6 // RUN: env KMP_DISP_NUM_BUFFERS=7 %libomp-run
7 // RUN: %libomp-compile -DMY_SCHEDULE=guided
8 // RUN: env KMP_DISP_NUM_BUFFERS=1 %libomp-run
9 // RUN: env KMP_DISP_NUM_BUFFERS=3 %libomp-run
10 // RUN: env KMP_DISP_NUM_BUFFERS=4 %libomp-run
11 // RUN: env KMP_DISP_NUM_BUFFERS=7 %libomp-run
12 // UNSUPPORTED: clang-11, clang-12
17 #include "omp_testsuite.h"
24 # define MY_SCHEDULE dynamic
27 int a
, b
, a_known_value
, b_known_value
;
29 int test_kmp_set_disp_num_buffers()
34 // run many small dynamic loops to stress the dispatch buffer system
38 for (j
= 0; j
< NUM_LOOPS
; j
++) {
39 #pragma omp for schedule(MY_SCHEDULE) nowait
40 for (i
= MY_MIN
; i
< MY_MAX
; i
+=INCR
) {
44 #pragma omp for schedule(MY_SCHEDULE) nowait
45 for (i
= MY_MAX
; i
>= MY_MIN
; i
-=INCR
) {
52 if (a
!= a_known_value
|| b
!= b_known_value
) {
54 printf("a = %d (should be %d), b = %d (should be %d)\n", a
, a_known_value
,
60 int main(int argc
, char** argv
)
65 // figure out the known values to compare with calculated result
69 for (j
= 0; j
< NUM_LOOPS
; j
++) {
70 for (i
= MY_MIN
; i
< MY_MAX
; i
+=INCR
)
72 for (i
= MY_MAX
; i
>= MY_MIN
; i
-=INCR
)
76 for(i
= 0; i
< REPETITIONS
; i
++) {
77 if(!test_kmp_set_disp_num_buffers()) {
84 printf("failed %d\n", num_failed
);