Professional Documents
Culture Documents
– Flow dependency
– Anti dependency
– Output dependency
– I/O dependency
Flow dependence:
• A statement S2 is flow-dependent on
statement S1 if an execution path exists
from S1 to S2 and if at least one output on
S1 feeds in as input to S2.
S1 S2
S4 S3
Dependency Graph
Example:
I/O
S1 S3
P1: C = D * E
P2: M = G + C
P3: A = B + C
P4: C = L + M
P5: F = G / E
Dependence graph
* P1
P2 P4
P5
+1 +3 /
P3 +2
Grain Size & Latency
• Grain size or granularity is a measure of the amount of
computation involved in a software process. The simplest
measure is to count the number of instructions in a grain.
4, 0 j, 4 k, 4
h, 4 3, 0
i, 4
12,2
g, 4
13,2 l, 3
14,2 m, 3
15,2 n, 4
16,2 o, 3
17,2 p, 3
q, 0
After Grain Packing
A, 8
(a, 6); (b, 6) (k, 4) (4,0); (3,0)
(i, 4)
(g, 4); (h, 4)
(n, 4)
E, 6
6 4
1 1
Processor 1 5 Processor 2
2
8
7
11
10
10
9
1
10
2
11
3
14
12
Fig: Scheduling of fine grain
12
16
19
13
18
9 21
20
8
24
22
7 14 Notations used
24 26
Communication delay
30
15
28 32
Node id Execution time for grain
35
16
I 37
40 I Idle time
17
42
P1 A P2
I
18 18
22
22
D Notations used
28 I
Communication delay
32
E
Node id Execution time for grain
38
I Idle time
Node Duplication:
P1 P2 P1 P2
A I
4 4
5
B
A, 4 6
7
a, 1
a, 8
12
C
I 13
C, 1 13
14
B, 1 E
16
20
c, 1 21
b, 1 c, 8 D
23
D, 2 E, 2
27
d, 4 e, 4
Schedule with node duplication
P2 A A
P1
4 4
5 5
A,4 A’, 4 B C
6 6
C
a,1 a,1 7 7
a, 1 8 E
9
D
10
B,1 C’,1 C, 1
13
14
b,1 c, 1 c, 1
D,2 E, 2
d, 4 e, 4
Example: Two 2*2 matrices A and B are multiplied to compute the sum of
the four elements in the resulting product matrix C = A* B.
A B C D E F G H
* * * * * * * *
d d
d d d d d
d
J + K + L + M +
d d d d
N + O +
d d
+
P
Sum
A Sequential schedule
101
A
202
B
303
C
404
D
E
505
F Time
606
707
G
808
H
816 J
824
K
832
L
840 M
848
N
O
856
864
P
A Parallel schedule
P1 P2 P3 P4 P5 P6 P7 P8
101 A B C D E F G H
313
321 J K L M
533
541
N O
753
761
P
After grain packing
V W X Y
A, * B, * C, * D,* E, * F,* G, * H, *
J, + K, + L, + M, +
N, + O, +
P, +
Parallel schedule for the packed programs
P1 P2 P3 P4
101
A C E G
B V D W F X H Y
202
210 J K L M
422
N
430
438
O Z
446
P