Title: Cilk-NOW
1Cilk-NOW
Adaptive and Reliable Parallel Computing on
Networks of Workstations Robert D. Blumofe
(Univ. of Texas) Philip A. Lisiecki (MIT)
Proceedings of the USENIX Annual Technical
Conference, 1997
2Cilk??
- C??????????????????????????
- DAG??????
3Cilk-NOW
- ???PC??Cilk???????????????????
- ???Cilk
- PC????????????????
- ????
4?????
- Cilk??
- ???
- work stealing??????
- ??????
- PC?????????
- ????
- ???????????
- ???
5thread Fib (cont int k, int n) if (n lt2)
send_argument (k,n) else cont int x, y
spawn_next Sum (k, ?x, ?y) spawn Fib (x,
n-1) spawn Fib (y, n-2) thread Sum (cont
int k, int x, int y) send_argument (k, xy)
6Cilk??? (1/3)
- spawn T (args )
- spawn_next T (args )
- ??????T??????
- ?????????????closure???
Sum
0
Fib
Join counter
0
k
??Argument slots
??Argument slots
k
Arguments
Arguments
n9
?Join counter??Argument slots?(0?????)
7Cilk??? (3/3)
- cont
- continuation
- ??empty argument slot????
- ?closure???????
- argument slot???????????
Sum
2
k
continuation
8Cilk??? (2/3)
- send_argument(k, value)
- continuation k??????argument slot?value???
9???
10???
11???
Sum
1
k
21
12???
Sum
0
k
21
13
13work stealing?????? (1/3)
- ?????? ready deque???
- ?????closure??????
- join counter?0????closure? deque????????
- deque????????????
14work stealing?????? (2/3)
- ready deque??????work stealing????
- thief??????victim???
- steal request?victim???
- victim?
- ready deque???????,deque????closure?thief???
- ready deque????,thief????????
????thief ?????victim
15work stealing?????? (3/3)
- ?????closure???????
- ?????????????
- ???closure????spawn???????
- ????closure?????work???
- ????????????,???work????
- ??????????
- ??3???????????
16work stealing??? (1/3)
sequential execution spawn spawn_next continuation
instruction thread procedure
17work stealing??? (2/3)
- well structured?????
- ???procedure?????????
- ??,?????procedure?????thread??????
18work stealing??? (3/3)
- well structured?????????
- T1/P T8????????
- ? P ?????
- T1 DAG??instruction?
- (1????????????)
- T8 DAG??????
- (critical path?)
DAG??critical path???closure?, ready
deque?????????????????
19??????
- ???PC??(???)Cilk????????????????
- PC???,???????????????
????? A
????? C
????? B
20???????????
- ????????????,
- ????????closure???
- ?????????,
- ?closure??????????
- ??????continuation???????
?waiting closure???????????
21???????????
- work stealing?????
- subcomputationresult closure???
- ??????
- subcomputation???
22work stealing????? (1/5)
- subcomputation
- ready, waiting, assigned pool???????
- global?unique?name???
- PC?local?unique???
- work steal???????
23work stealing????? (2/5)
- thief?,
- subcomputation???
- steal??????victim???
victim s
thief r
subcomputation si
assigned
waiting
ready
24work stealing????? (3/5)
- victim?,
- ready pool?????subcomputation?round-robin???
- ready pool????closure?assigned pool???
- thief????thief?subcomputation??????
victim s
thief r
subcomputation si
assigned
waiting
ready
25work stealing????? (3/5)
- victim?,
- ready pool?????subcomputation?round-robin???
- ready pool????closure?assigned pool???
- thief????thief?subcomputation??????
thief name
victim s
thief r
thief subcomp.
subcomputation si
assigned
waiting
ready
r rj
26work stealing????? (4/5)
- victim??thief?closure???
- thief?victim worker??????
- thief?result closure???
- ?????closure??continuation?,
- result closure????????????
victim s
thief r
subcomputation si
assigned
waiting
ready
r rj
27work stealing????? (5/5)
victim s
thief r
s
subcomputation si
assigned
waiting
ready
r rj
28work stealing????? (5/5)
victim s
thief r
subcomputation si
assigned
waiting
ready
29??????
- subcomputation???
- subcomputation?serialize
- continuation???
- ?????????,
- victim worker?????????
- victim closure??thief subcomputation???
- assigned pool?????thief worker?????????
- victim worker name???
30??????
worker t
subcomputation tk
assigned
waiting
ready
s si
worker s
worker u
t
subcomputation si
assigned
waiting
ready
r rj
worker r
s
31??????
worker t
subcomputation tk
assigned
waiting
ready
s si
worker s
worker u
worker u
t
subcomputation si
assigned
waiting
ready
r rj
worker r
s
32??????
worker t
subcomputation tk
assigned
waiting
ready
s si
worker u
worker s
t
subcomputation si
assigned
waiting
ready
r rj
worker r
s
33????
- PC????????????????????????????
- ?subcomputation????
- ???????????
34subcomputation???? (1/2)
- subcomputation?????????subcomputation???????????
- subcomputation??????return value?????
- ?well-structured???????
- transaction?????
- return value?????????commit
35subcomputation???? (2/2)
- ?????????,
- ????subcomputation???continuation???subcomputation
?abort - abort??subcomputation???continuation???subcomputat
ion?abort - ????subcomputation??????continuation???subcomputat
ion?,????subcomputation????
? PC????????????
36worker t
???
subcomputation tk
assigned
waiting
ready
s si
worker s
t
subcomputation si
assigned
waiting
ready
r rj
worker r
s
abort
37???????????
- ?????????????
- c.f.)DAG???????subcomputation????
- subcomputation????????????
38????
- ?????Cilk-NOW?????????
- SilkRoad2000
- Cilk-NOW SoftwareDSM
- Satin2001
- ???????????Scheduling??
- Concert2002
- ??????????????????
39???
- ???PC??Cilk???????????????????
- ???Cilk
- PC????????????????
- ????
40?????
- thiefvictim???????????
- ???????????????????
- ????????
- ??????????????????
- ????????????????