blob: 7e6968fe980e5a559b9b810c65d7a87b3cc9ff16 (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#include <unistd.h>
#include <stdlib.h>
int
main ()
{
int a[128];
#pragma omp teams num_teams(5)
{
#pragma omp loop bind(teams)
for (int i = 0; i < 128; i++)
{
a[i] = i;
if (i == 0)
usleep (20);
else if (i == 17)
usleep (40);
}
#pragma omp loop bind(teams)
for (int i = 0; i < 128; i++)
a[i] += i;
}
for (int i = 0; i < 128; i++)
if (a[i] != 2 * i)
abort ();
#pragma omp teams num_teams(5)
{
#pragma omp loop bind(teams) order(concurrent)
for (int i = 0; i < 128; i++)
{
a[i] *= 2;
if (i == 1)
usleep (20);
else if (i == 13)
usleep (40);
}
#pragma omp loop bind(teams) order(concurrent)
for (int i = 0; i < 128; i++)
a[i] += i;
}
for (int i = 0; i < 128; i++)
if (a[i] != 5 * i)
abort ();
#pragma omp teams num_teams(5)
{
#pragma omp loop bind(teams) order(reproducible:concurrent)
for (int i = 0; i < 128; i++)
{
a[i] *= 2;
if (i == 2)
usleep (20);
else if (i == 105)
usleep (40);
}
#pragma omp loop bind(teams) order(reproducible:concurrent)
for (int i = 0; i < 128; i++)
a[i] += i;
}
for (int i = 0; i < 128; i++)
if (a[i] != 11 * i)
abort ();
return 0;
}
|