1 // This test is known to be fragile on NetBSD kernel at the moment.
3 // RUN: %libomp-compile-and-run
4 // RUN: %libomp-compile && env KMP_TASKLOOP_MIN_TASKS=1 %libomp-run
6 // These compilers don't support the taskloop construct
7 // UNSUPPORTED: gcc-4, gcc-5, icc-16
9 // This test is known to be fragile on NetBSD kernel at the moment,
10 // https://bugs.llvm.org/show_bug.cgi?id=42020.
11 // UNSUPPORTED: netbsd
15 * Method: calculate how many times the iteration space is dispatched
16 * and judge if each dispatch has the requested grainsize
17 * It is possible for two adjacent chunks are executed by the same thread
22 #include "omp_testsuite.h"
24 #define CFDMAX_SIZE 1120
26 int test_omp_taskloop_num_tasks()
35 for (num_tasks
= 1; num_tasks
< 120; ++num_tasks
) {
37 tidsArray
= (int *)malloc(sizeof(int) * CFDMAX_SIZE
);
40 #pragma omp parallel shared(tids)
44 #pragma omp taskloop num_tasks(num_tasks)
45 for (i
= 0; i
< CFDMAX_SIZE
; i
++) {
46 tids
[i
] = omp_get_thread_num();
50 for (i
= 0; i
< CFDMAX_SIZE
- 1; ++i
) {
51 if (tids
[i
] != tids
[i
+ 1]) {
56 if (count
> num_tasks
) {
57 fprintf(stderr
, "counted too many tasks: (wanted %d, got %d)\n",
71 for (i
= 0; i
< REPETITIONS
; i
++) {
72 if (!test_omp_taskloop_num_tasks()) {