1 | // RUN: %libomp-compile-and-run |
2 | |
3 | #include <stdio.h> |
4 | #include <omp.h> |
5 | #include "omp_testsuite.h" |
6 | |
7 | /* Test that the chunk size is set to default (1) when |
8 | chunk size <= 0 is specified */ |
9 | int a = 0; |
10 | |
11 | int test_set_schedule_0() |
12 | { |
13 | int i; |
14 | a = 0; |
15 | omp_set_schedule(omp_sched_dynamic,0); |
16 | |
17 | #pragma omp parallel |
18 | { |
19 | #pragma omp for schedule(runtime) |
20 | for(i = 0; i < 10; i++) { |
21 | #pragma omp atomic |
22 | a++; |
23 | if(a > 10) |
24 | exit(status: 1); |
25 | } |
26 | } |
27 | return a==10; |
28 | } |
29 | |
30 | int main() |
31 | { |
32 | int i; |
33 | int num_failed=0; |
34 | |
35 | for(i = 0; i < REPETITIONS; i++) { |
36 | if(!test_set_schedule_0()) { |
37 | num_failed++; |
38 | } |
39 | } |
40 | return num_failed; |
41 | } |
42 | |