1 | // RUN: %gdb-compile 2>&1 | tee %t.compile |
2 | // RUN: %gdb-test -x %S/ompd_bt.cmd %t 2>&1 | tee %t.out | FileCheck %s |
3 | |
4 | // REQUIRES: determinism |
5 | |
6 | #include <omp.h> |
7 | |
8 | void subdomain(float *x, int istart, int ipoints) { |
9 | int i; |
10 | |
11 | for (i = 0; i < ipoints; i++) |
12 | x[istart + i] = 123.456; |
13 | } |
14 | |
15 | void sub(float *x, int npoints) { |
16 | int iam, nt, ipoints, istart; |
17 | |
18 | #pragma omp parallel default(shared) private(iam, nt, ipoints, istart) |
19 | { |
20 | iam = omp_get_thread_num(); |
21 | nt = omp_get_num_threads(); |
22 | ipoints = npoints / nt; /* size of partition */ |
23 | istart = iam * ipoints; /* starting array index */ |
24 | if (iam == nt - 1) /* last thread may do more */ |
25 | ipoints = npoints - istart; |
26 | subdomain(x, istart, ipoints); |
27 | } |
28 | } |
29 | |
30 | int main() { |
31 | |
32 | omp_set_num_threads(5); |
33 | float array[10000]; |
34 | |
35 | sub(x: array, npoints: 10000); |
36 | |
37 | return 0; |
38 | } |
39 | |
40 | // CHECK: Loaded OMPD lib successfully! |
41 | |
42 | // CHECK: Enabled filter for "bt" output successfully. |
43 | // CHECK-NOT: {{__kmp.*}} |
44 | |
45 | // CHECK: Disabled filter for "bt" output successfully |
46 | // CHECK: {{__kmp.*}} |
47 | |
48 | // CHECK-NOT: Python Exception |
49 | // CHECK-NOT: The program is not being run. |
50 | // CHECK-NOT: No such file or directory |
51 | |