Debian Codegraph @

libgomp/testsuite/libgomp.c++/parallel-1.C

raw
1 #include <omp.h>
2
3 extern "C" void abort (void);
4
5 int
6 foo (void)
7 {
8 return 10;
9 }
10
11 int
12 main ()
13 {
14 int A = 0;
15
16 #pragma omp parallel if (foo () > 10) shared (A)
17 {
18 A = omp_get_num_threads ();
19 }
20
21 if (A != 1)
22 abort ();
23
24 #pragma omp parallel if (foo () == 10) num_threads (3) shared (A)
25 {
26 A = omp_get_num_threads ();
27 }
28
29 if (A != 3)
30 abort ();
31
32 #pragma omp parallel if (foo () == 10) num_threads (foo ()) shared (A)
33 {
34 A = omp_get_num_threads ();
35 }
36
37 if (A != 10)
38 abort ();
39
40 return 0;
41 }