| 1 |
// RUN: %libomp-compile |
| 2 |
// RUN: env KMP_TASKING=0 %libomp-run |
| 3 |
// RUN: env KMP_TASKING=1 %libomp-run |
| 4 |
// RUN: env KMP_TASKING=2 %libomp-run |
| 5 |
// |
| 6 |
// Test to make sure the KMP_TASKING=1 option doesn't crash |
| 7 |
// Can use KMP_TASKING=0 (immediate exec) or 2 (defer to task queue |
| 8 |
// and steal during regular barrier) but cannot use |
| 9 |
// KMP_TASKING=1 (explicit tasking barrier before regular barrier) |
| 10 |
#include <omp.h> |
| 11 |
#include <stdio.h> |
| 12 |
#include <stdlib.h> |
| 13 |
int main() { |
| 14 |
int i; |
| 15 |
#pragma omp parallel |
| 16 |
{ |
| 17 |
#pragma omp single |
| 18 |
{ |
| 19 |
for (i = 0; i < 10; i++) { |
| 20 |
#pragma omp task |
| 21 |
{ |
| 22 |
printf("Task %d executed by thread %d\n", i, omp_get_thread_num()); |
| 23 |
} |
| 24 |
} |
| 25 |
} |
| 26 |
} |
| 27 |
return EXIT_SUCCESS; |
| 28 |
} |