Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libompd / test / openmp_examples / example_task.c
blob769ff3ffa71672df8f85439616874ffd130b9390
1 // RUN: %gdb-compile-and-run 2>&1 | tee %t.out | FileCheck %s
3 #include "../ompt_plugin.h"
4 #include <omp.h>
5 #include <pthread.h>
6 #include <stdio.h>
7 #include <unistd.h>
9 void f(int i) {
10 if (i <= 0) {
11 ompd_tool_test(0);
12 } else {
13 printf("f(%i) start task 1\n", i);
14 #pragma omp task
15 f(i - 1);
16 printf("f(%i) start task 2\n", i);
17 #pragma omp task
18 f(i - 1);
19 printf("f(%i) start task 3\n", i);
20 #pragma omp task
21 f(i - 1);
22 #pragma omp taskwait
26 int main() {
27 printf("Application: Process %d started.\n", getpid());
28 omp_set_num_threads(8);
29 omp_set_max_active_levels(10);
31 #pragma omp parallel sections
32 { f(4); }
34 return 0;
37 // CHECK-NOT: OMPT-OMPD mismatch
38 // CHECK-NOT: Python Exception
39 // CHECK-NOT: The program is not being run.