1// RUN: %gdb-compile 2>&1 | tee %t.compile
2// RUN: env OMP_SCHEDULE=guided,10 %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
9int main() {
10 printf(format: "Application: Process %d started.\n", getpid());
11
12 int i;
13 omp_set_num_threads(3);
14 omp_set_max_active_levels(10);
15
16#pragma omp parallel // parallel region begins
17 {
18 printf(format: "outer parallel region Thread ID == %d\n", omp_get_thread_num());
19 /* Code for work to be done by outer parallel region threads over here. */
20
21 if (omp_get_thread_num() == 2)
22 sleep(seconds: 1);
23
24#pragma omp parallel num_threads(2) // nested parallel region
25 {
26 /* Code for work to be done by inner parallel region threads over here. */
27 printf(format: "inner parallel region thread id %d\n", omp_get_thread_num());
28
29 // if (omp_get_thread_num() == 1) sleep(1000);
30
31#pragma omp parallel num_threads(2) //
32 {
33
34#pragma omp for
35 for (i = 0; i < 20; i++) {
36 // Some independent iterative computation to be done.
37 printf(format: "");
38 ompd_tool_test(n: 0);
39 }
40 }
41 }
42 }
43
44 // sleep(1000);
45
46 return 0;
47}
48
49// CHECK-NOT: OMPT-OMPD mismatch
50// CHECK-NOT: Python Exception
51// CHECK-NOT: The program is not being run.
52

source code of openmp/libompd/test/openmp_examples/nested.c