1// RUN: %gdb-compile 2>&1 | tee %t.compile
2// RUN: %gdb-test -x %S/ompd_parallel.cmd %t 2>&1 | tee %t.out | FileCheck %s
3
4// REQUIRES: determinism
5
6#include <omp.h>
7#include <stdio.h>
8
9int main() {
10 omp_set_max_active_levels(3);
11 omp_set_num_threads(7);
12#pragma omp parallel
13 {
14 omp_set_num_threads(5);
15#pragma omp parallel
16 {
17 omp_set_num_threads(3);
18#pragma omp parallel
19 { printf(format: "In nested level:3, team size = %d.\n", omp_get_num_threads()); }
20
21 printf(format: "In nested level:2, team size = %d.\n", omp_get_num_threads());
22 }
23 printf(format: "In nested level:1, team size = %d.\n", omp_get_num_threads());
24 }
25
26 return 0;
27}
28
29// CHECK: Loaded OMPD lib successfully!
30// CHECK: Nesting Level 3: Team Size: 3
31// CHECK: ompd_parallel.c{{[ ]*}}:16
32// CHECK: Nesting Level 2: Team Size: 5
33// CHECK: ompd_parallel.c{{[ ]*}}:13
34// CHECK: Nesting Level 1: Team Size: 7
35// CHECK: ompd_parallel.c{{[ ]*}}:10
36
37// CHECK: Nesting Level 2: Team Size: 5
38// CHECK: ompd_parallel.c{{[ ]*}}:13
39// CHECK: Nesting Level 1: Team Size: 7
40// CHECK: ompd_parallel.c{{[ ]*}}:10
41
42// CHECK: Nesting Level 1: Team Size: 7
43// CHECK: ompd_parallel.c{{[ ]*}}:10
44
45// CHECK-NOT: Python Exception
46// CHECK-NOT: The program is not being run.
47// CHECK-NOT: No such file or directory
48

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