29 lines · c
1// RUN: %libomp-compile2// RUN: env KMP_TASKING=0 %libomp-run3// RUN: env KMP_TASKING=1 %libomp-run4// RUN: env KMP_TASKING=2 %libomp-run5//6// Test to make sure the KMP_TASKING=1 option doesn't crash7// Can use KMP_TASKING=0 (immediate exec) or 2 (defer to task queue8// and steal during regular barrier) but cannot use9// KMP_TASKING=1 (explicit tasking barrier before regular barrier)10#include <omp.h>11#include <stdio.h>12#include <stdlib.h>13int main() {14 int i;15#pragma omp parallel16 {17#pragma omp single18 {19 for (i = 0; i < 10; i++) {20#pragma omp task21 {22 printf("Task %d executed by thread %d\n", i, omp_get_thread_num());23 }24 }25 }26 }27 return EXIT_SUCCESS;28}29