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