comparison 2018/2018_01_30/slide.md @ 31:b7908b2f86c0 default tip

Update slide 2018_01_30
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Tue, 30 Jan 2018 18:43:00 +0900
parents
children
comparison
equal deleted inserted replaced
30:d2e208431fbf 31:b7908b2f86c0
1 title: Gears OS による並列処理
2 author: Tatsuki IHA
3 profile:
4 lang: Japanese
5 code-engine: coderay
6
7 ## 研究目的
8 - 当研究室では 処理の単位を Code Gear、 データの単位を Data Gear を用いて 信頼性が高い並列処理を行う Gears OS を開発している
9 - Gears OS では Task を Code Gear と実行するときに必要な Input Data Gear と出力するための Output Data Gear の組で表現される。 Input Data Gear/Output Data Gear によって依存関係が決定し、それにそって並列実行を行う.
10 - 信頼性の確保はモデルチェック、検証等を使用して行う。この信頼性のための計算は通常の計算とは別の階層のメタ計算として記述する。
11 - また、 メタ計算は信頼性の他に CPU, GPU などの実行環境の切り替え, データ拡張等の柔軟性を提供する。
12 - 本研究では、 Gears OS の並列処理機構の実装を行う。また、並列処理の検証をメタ計算として記述することで、 並列処理の信頼性を保証する。
13
14 ## 今週
15 - 修論書いてます
16 - Interface の チャプターを追加しました
17 - par goto で実行される code gear の context 生成
18 - Go で twice を書いてみて Gears と測定してみました
19
20 ## par goto で実行される Code Gear の Context 生成
21 - Interface として属してない Code Gear を並列実行した際の stub を自動生成出来るようにした
22 - ルールとしてファイル名と同じ Code Gear でないといけない
23 - しかし、 GPU を stub で切り替えるのはまだ
24
25 ``` c
26 __code add(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)) {
27 output->value = input1->value + input2->value;
28 printf("%d + %d = %d\n", input1->value, input2->value, output->value);
29
30 goto next(output, ...);
31 }
32
33
34
35 __code add(struct Context *context,struct Integer* input1, struct Integer* input2, enum Code next,struct Integer **O_output) {
36 Integer* output = *O_output;
37 output->value = input1->value + input2->value;
38 printf("%d + %d = %d\n", input1->value, input2->value, output->value);
39 *O_output = output;
40 goto meta(context, next);
41 }
42 __code add_stub(struct Context* context) {
43 Integer* input1 = &context->data[context->idg + 0]->Integer;
44 Integer* input2 = &context->data[context->idg + 1]->Integer;
45 enum Code next = context->next;
46 Integer** O_output = (Integer **)&context->data[context->odg + 0];
47 goto add(context, input1, input2, next, O_output);
48 }
49
50 ```
51
52 ## go lang な twice を書いてみました
53 - Gears の並列処理の比較として書いた
54 - やっぱり go ルーチンは par goto と似てる
55 - データの待ち合わせは channelで行われる
56 - channel で待つような構文を書く必要がある
57 - Gears は待つような構文ではなく, output Data Gear を書き出す(``goto next(Output1, ...)``) 処理で データの待ち合わせ
58
59 ``` c
60 ...
61 func twice(list []int, prefix int, index int, c chan []int) {
62 for i := 0; i < prefix; i++ {
63 list[prefix*index+i] = list[prefix*index+i] * 2;
64 }
65 c <- list
66 }
67
68 func main() {
69 ...
70
71 start := time.Now()
72 c := make(chan []int)
73 for i :=0; i < *split; i++ {
74 go twice(list, prefix, i, c);
75 }
76
77 for i :=0; i < *split; i++ {
78 <- c
79 }
80 t := time.Now()
81 elapsed := t.Sub(start)
82 fmt.Println(elapsed)
83
84 for i :=0; i < *length; i++ {
85 if (i*2 != list[i]) {
86 fmt.Println("wrong result")
87 }
88 }
89 }
90 ```
91
92 ## 比較(firefly)
93 - firefly
94 - cpu は 12
95 - twice
96 - 長さ 2^24
97 - タスク数 64
98 - シングルコアだと go が10倍くらい速い
99 - context の生成で時間かかってる?
100
101 <div style="text-align: center;">
102 <img src="./pictures/firefly.svg" alt="message" width="800">
103 </div>
104
105 ## 比較(dalmore)
106 - dalmore
107 - cpu は 36
108 - twice
109 - 長さ 2^24
110 - タスク数 64
111
112 <div style="text-align: center;">
113 <img src="./pictures/dalmore.svg" alt="message" width="800">
114 </div>
115