xref: /llvm-project/openmp/libompd/test/openmp_examples/example_3.c (revision 1099498e3f35b2ad4b021ba3888b590259124e74)
1 // RUN: %gdb-compile 2>&1 | tee %t.compile
2 // RUN: env OMP_SCHEDULE=static %gdb-run 2>&1 | tee %t.out | FileCheck %s
3 
4 #include "../ompt_plugin.h"
5 #include <omp.h>
6 #include <stdio.h>
7 #include <unistd.h>
8 
bar()9 void bar() {
10   int i;
11 #pragma omp parallel for num_threads(2)
12   for (i = 0; i < 10; i++)
13     ompd_tool_test(0);
14 }
15 
foo()16 void foo() {
17   omp_set_max_active_levels(10);
18 #pragma omp parallel num_threads(2)
19   {
20     if (omp_get_thread_num() == 0)
21       ompd_tool_test(0);
22     else
23       bar();
24   }
25 }
26 
main()27 int main() {
28   printf("Process %d started.\n", getpid());
29   foo();
30   return 0;
31 }
32 
33 // CHECK-NOT: OMPT-OMPD mismatch
34 // CHECK-NOT: Python Exception
35 // CHECK-NOT: The program is not being run.
36