# HG changeset patch # User Tatsuki IHA # Date 1517305380 -32400 # Node ID b7908b2f86c00ae78b001be61cb15c106e7573ce # Parent d2e208431fbfa35aa5cc03c09384f711fef68b1c Update slide 2018_01_30 diff -r d2e208431fbf -r b7908b2f86c0 2018/2018_01_30/pictures/dalmore.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2018/2018_01_30/pictures/dalmore.svg Tue Jan 30 18:43:00 2018 +0900 @@ -0,0 +1,185 @@ + + + +Gnuplot +Produced by GNUPLOT 5.2 patchlevel 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + 20 + + + + + 40 + + + + + 60 + + + + + 80 + + + + + 100 + + + + + 120 + + + + + 140 + + + + + 160 + + + + + 180 + + + + + 200 + + + + + 220 + + + + + 5 + + + + + 10 + + + + + 15 + + + + + 20 + + + + + 25 + + + + + 30 + + + + + + + + + time(ms) + + + + + CPUs + + + + + twice + + + "gears_dalmore" + + + "gears_dalmore" + + + + + + "go_dalmore" + + + "go_dalmore" + + + + + + + + + + + + + + + + + + diff -r d2e208431fbf -r b7908b2f86c0 2018/2018_01_30/pictures/firefly.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2018/2018_01_30/pictures/firefly.svg Tue Jan 30 18:43:00 2018 +0900 @@ -0,0 +1,183 @@ + + + +Gnuplot +Produced by GNUPLOT 5.2 patchlevel 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + 20 + + + + + 40 + + + + + 60 + + + + + 80 + + + + + 100 + + + + + 120 + + + + + 140 + + + + + 160 + + + + + 180 + + + + + 200 + + + + + 220 + + + + + 2 + + + + + 4 + + + + + 6 + + + + + 8 + + + + + 10 + + + + + 12 + + + + + + + + + time(ms) + + + + + CPUs + + + + + twice + + + "gears_firefly" + + + "gears_firefly" + + + + + + "go_firefly" + + + "go_firefly" + + + + + + + + + + + + + + + + + + diff -r d2e208431fbf -r b7908b2f86c0 2018/2018_01_30/slide.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2018/2018_01_30/slide.md Tue Jan 30 18:43:00 2018 +0900 @@ -0,0 +1,115 @@ +title: Gears OS による並列処理 +author: Tatsuki IHA +profile: +lang: Japanese +code-engine: coderay + +## 研究目的 +- 当研究室では 処理の単位を Code Gear、 データの単位を Data Gear を用いて 信頼性が高い並列処理を行う Gears OS を開発している +- Gears OS では Task を Code Gear と実行するときに必要な Input Data Gear と出力するための Output Data Gear の組で表現される。 Input Data Gear/Output Data Gear によって依存関係が決定し、それにそって並列実行を行う. +- 信頼性の確保はモデルチェック、検証等を使用して行う。この信頼性のための計算は通常の計算とは別の階層のメタ計算として記述する。 +- また、 メタ計算は信頼性の他に CPU, GPU などの実行環境の切り替え, データ拡張等の柔軟性を提供する。 +- 本研究では、 Gears OS の並列処理機構の実装を行う。また、並列処理の検証をメタ計算として記述することで、 並列処理の信頼性を保証する。 + +## 今週 +- 修論書いてます + - Interface の チャプターを追加しました +- par goto で実行される code gear の context 生成 +- Go で twice を書いてみて Gears と測定してみました + +## par goto で実行される Code Gear の Context 生成 +- Interface として属してない Code Gear を並列実行した際の stub を自動生成出来るようにした +- ルールとしてファイル名と同じ Code Gear でないといけない +- しかし、 GPU を stub で切り替えるのはまだ + +``` c +__code add(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)) { + output->value = input1->value + input2->value; + printf("%d + %d = %d\n", input1->value, input2->value, output->value); + + goto next(output, ...); +} + +↓ + +__code add(struct Context *context,struct Integer* input1, struct Integer* input2, enum Code next,struct Integer **O_output) { + Integer* output = *O_output; + output->value = input1->value + input2->value; + printf("%d + %d = %d\n", input1->value, input2->value, output->value); + *O_output = output; + goto meta(context, next); +} +__code add_stub(struct Context* context) { + Integer* input1 = &context->data[context->idg + 0]->Integer; + Integer* input2 = &context->data[context->idg + 1]->Integer; + enum Code next = context->next; + Integer** O_output = (Integer **)&context->data[context->odg + 0]; + goto add(context, input1, input2, next, O_output); +} + +``` + +## go lang な twice を書いてみました +- Gears の並列処理の比較として書いた +- やっぱり go ルーチンは par goto と似てる + - データの待ち合わせは channelで行われる + - channel で待つような構文を書く必要がある + - Gears は待つような構文ではなく, output Data Gear を書き出す(``goto next(Output1, ...)``) 処理で データの待ち合わせ + +``` c +... +func twice(list []int, prefix int, index int, c chan []int) { + for i := 0; i < prefix; i++ { + list[prefix*index+i] = list[prefix*index+i] * 2; + } + c <- list +} + +func main() { + ... + + start := time.Now() + c := make(chan []int) + for i :=0; i < *split; i++ { + go twice(list, prefix, i, c); + } + + for i :=0; i < *split; i++ { + <- c + } + t := time.Now() + elapsed := t.Sub(start) + fmt.Println(elapsed) + + for i :=0; i < *length; i++ { + if (i*2 != list[i]) { + fmt.Println("wrong result") + } + } +} +``` + +## 比較(firefly) +- firefly +- cpu は 12 +- twice + - 長さ 2^24 + - タスク数 64 +- シングルコアだと go が10倍くらい速い + - context の生成で時間かかってる? + +
+ message +
+ +## 比較(dalmore) +- dalmore +- cpu は 36 +- twice + - 長さ 2^24 + - タスク数 64 + +
+ message +
+