changeset 25:678e6992c8ae

Update
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Tue, 20 Jun 2017 20:02:48 +0900
parents a05d9335563f
children ed48cf95acab
files 2017/2017_05_23/slide.md 2017/2017_05_30/slide.md 2017/2017_06_06/slide.md 2017/2017_06_20/slide.md
diffstat 4 files changed, 353 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/2017/2017_05_23/slide.md	Tue Jun 20 20:02:48 2017 +0900
@@ -0,0 +1,55 @@
+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 の並列処理機構の実装を行う。また、並列処理の実行を検証をメタ計算として記述することで、 並列処理の精度を保証する。
+
+## 今週
+- Task の interface
+
+## Taskの interface
+- par goto に変換するために, input, output の関係をinterface に押し込みたい
+
+
+``` c
+typedef struct Task<Impl>{
+        union Data* task;
+        enum Code code;
+        int idgCount;
+        int odgCount;
+        __code setTaskInfo(Impl* task, enum Code code, __code next(...)); 
+        __code next(...);
+} Semaphore;
+
+
+Task* createCPUTask(struct Context* context, int idgCount, int odgCount) {
+    Task* task = new Task();
+    task->task = (union Data*)NEW(struct Context);
+    initContext(&task->task->Context);
+    task->task->Context.idg = cpuTask->context->dataNum;
+    task->task->Context.idgCount = idgCount;
+    task->idgCount = idgCount;
+    task->odgCount = odgCount;
+    task->setTaskInfo = C_setTaskInfo;
+    return task
+}
+```
+
+
+## par goto からの変換
+
+``` c
+par goto code1(data1, data2, data3, _exit)
+```
+
+
+```c
+
+```
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/2017/2017_05_30/slide.md	Tue Jun 20 20:02:48 2017 +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 の並列処理機構の実装を行う。また、並列処理の実行を検証をメタ計算として記述することで、 並列処理の精度を保証する。
+
+## 今週
+- Task の interface
+
+## Taskの interface
+- par goto に変換するために, task を interface に押し込みたい
+
+
+``` c
+__code code1(struct Integer integer1, struct Integer integer2, struct Integer integer3) {
+  par goto add(integer1, integer2, integer3, _exit());
+  goto next_code();
+}
+
+
+## task の例題: 2つ input, 1つ output
+__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, ...);
+}
+```
+
+## CodeGear の interface
+- とりあえず meta level のコード(変換後されるはずのコード)を自前で書いてみることに
+- CodeGear のinterfaceの定義
+- code に実行する Code Gear 入れる?
+
+``` c
+typedef struct CodeGear<Impl>{
+        union Data* codeGear;
+        enum Code code;
+        __code code(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...));
+        __code setInfo(struct Context* codeGear, union Data** dataGears, __code next(...));
+        union Data* dataGears[10];
+        __code next(...);
+} CodeGear;
+```
+
+- task の context が CodeGear interface の実装になる?
+
+``` c
+CodeGear* createAddCodeGear(struct Context* context) {
+    struct CodeGear* codeGear = new CodeGear();
+    struct context* addContext = NEW(struct Context);
+    codeGear->codeGear = (union Data*)addContext;
+    initContext(addContext);
+    codeGear->code = C_add;
+    codeGear->setInfo = C_setAddCodeGearInfo;
+    return codeGear;
+}
+```
+
+## CodeGear の setInfo
+- context の設定(もともとべた書きされてた部分)
+- ここで, dependency の設定と spawn までの一連の流れをやってる
+
+``` c
+__code setAddCodeGearInfo(struct Context* codeGear, union Data** dataGears, __code next(...)) {
+    codeGear->next = C_add;
+    codeGear->idgCount = 2;
+    codeGear->idg = codeGear->datanum;
+    codeGear->data[codeGear->idg] = dataGears[0];
+    codeGear->data[codeGear->idg+1] = dataGears[1];
+    codeGear->maxIdg = codeGear->idg + 2;
+    codeGear->odg = codeGear->maxIdg;
+    codeGear->data[codeGear->odg] = dataGears[2];
+    task->maxOdg = task->odg + 1;
+    goto meta(context, C_setWaitTask)
+}
+```
+
+- 呼び出しは interfaceを呼び出す用に引数を指定
+
+``` c
+__code createTask3(LoopCounter* loopCounter, TaskManager* taskManager, Integer *integer1, Integer *integer2, Integer *integer3) {
+    int i = loopCounter->i;
+    integer1->value = i;
+    integer2->value = i+1;
+    
+    // ここから下もpar goto から自動生成
+    codeGear->codeGear= createAddCodeGear(context);
+    codeGear->codeGear[0] = (union Data*)integer1;
+    codeGear->codeGear[1] = (union Data*)integer2;
+    codeGear->codeGear[2] = (union Data*)integer3;
+    codeGear->next = C_createTask1;
+    goto meta(context, codeGear->codeGear->CodeGear.setInfo);
+}
+```
+
+
+## ちょっと考え中
+
+``` c
+typedef struct CodeGear<Impl>{
+        union Data* codeGear;
+        enum Code code;
+        __code code(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...));
+        __code setInfo(struct Context* codeGear, union Data** dataGears, __code next(...));
+        union Data* dataGears[10];
+        __code next(...);
+} CodeGear;
+```
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/2017/2017_06_06/slide.md	Tue Jun 20 20:02:48 2017 +0900
@@ -0,0 +1,79 @@
+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 の並列処理機構の実装を行う。また、並列処理の実行を検証をメタ計算として記述することで、 並列処理の精度を保証する。
+
+## 今週
+- バイト先の合宿で北部にいました
+- par goto のメタ部分のまとめ
+
+## 並列に実行される CodeGear の変換
+- stub の生成は context を参照するように変換(ここは先週の CodeGear interface の引数でとってもよさそう)
+- ここで inputと output の関係がわかるはず
+
+``` 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, ...);
+}
+```
+
+↓
+
+``` c
+__code add(struct Context *context,struct Integer* input1, struct Integer* input2, enum Code next,struct Integer **O_output) {
+    struct 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** O_output = (struct Integer **)&context->data[context->odg];
+    goto add(context,
+            &context->data[context->idg]->Integer,
+            &context->data[context->idg + 1]->Integer,
+            context->next,
+            O_output);
+}
+```
+
+## par goto 呼び出し部分の変換
+
+``` c
+__code code1(TaskManager* taskManager, Integer *integer1, Integer *integer2, Integer *integer3) {
+    par goto add(integer1, integer2, integer3, __exit);
+}
+```
+
+↓
+
+``` c
+__code code1(TaskManager* taskManager, Integer *integer1, Integer *integer2, Integer *integer3) {
+    struct Context* task = NEW(struct Context);
+    initContext(task);
+    task->taskManager = &taskManager->taskManager->TaskManager;
+    task->next = C_add;
+    task->idgCount = 2;
+    task->idg = task->dataNum;
+    task->data[task->idg] = (union Data*)integer1;
+    task->data[task->idg+1] = (union Data*)integer2;
+    task->maxIdg = task->idg + 2;
+    task->odg = task->maxIdg;
+    task->data[task->odg] = (union Data*)integer3;
+    task->maxOdg = task->odg + 1;
+    taskManager->context = task;
+    taskManager->next = C_createTask3;
+    goto meta(context, taskManager->taskManager->TaskManager.setWaitTask);
+}
+```
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/2017/2017_06_20/slide.md	Tue Jun 20 20:02:48 2017 +0900
@@ -0,0 +1,104 @@
+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 の並列処理機構の実装を行う。また、並列処理の実行を検証をメタ計算として記述することで、 並列処理の精度を保証する。
+
+## 今週
+- GPU VDI
+- par goto のメタ部分のまとめ
+
+## par goto が複数ある場合の変換
+- たとえば, 1つのCS内に複数のpar goto があった場合
+
+``` c
+__code code1(struct ...) {
+  Integer* integer1 = &ALLOCATE_DATA_GEAR(context, Integer)->Integer;
+  Integer* integer2 = &ALLOCATE_DATA_GEAR(context, Integer)->Integer;
+  Integer* integer3 = &ALLOCATE_DATA_GEAR(context, Integer)->Integer;
+  Integer* integer4 = &ALLOCATE_DATA_GEAR(context, Integer)->Integer;
+  Integer* integer5 = &ALLOCATE_DATA_GEAR(context, Integer)->Integer;
+
+  // 複数の par goto
+  par goto add(integer1, integer2, integer3, __exit);
+  par goto mult(integer3, integer4, integer5, __exit);
+  goto code2(...);
+}
+```
+
+- 実行する task の 配列を生成して, それを spawn する
+
+``` c
+__code code1(struct ...) {
+  Integer* integer1 = &ALLOCATE_DATA_GEAR(context, Integer)->Integer;
+  ...
+  Integer* integer5 = &ALLOCATE_DATA_GEAR(context, Integer)->Integer;
+
+  // task の配列を生成
+  struct Context** tasks = (struct Context**)ALLOC_ARRAY(context, Context, 3);
+
+  // par goto add(integer1, integer2, integer3, __exit);
+  struct Context* task = NEW(struct Context);
+  initContext(task);
+  task->taskManager = &taskManager->taskManager->TaskManager;
+  task->next = C_add;
+  task->idgCount = 2;
+  task->idg = task->dataNum;
+  task->data[task->idg] = (union Data*)integer1;
+  task->data[task->idg+1] = (union Data*)integer2;
+  task->maxIdg = task->idg + 2;
+  task->odg = task->maxIdg;
+  task->data[task->odg] = (union Data*)integer3;
+  task->maxOdg = task->odg + 1;
+  // task を登録
+  tasks[0] = task;
+
+  // par goto mult(integer3, integer4, integer5, __exit);
+  task = NEW(struct Context);
+  initContext(task);
+  task->taskManager = &taskManager->taskManager->TaskManager;
+  task->next = C_mult;
+  task->idgCount = 2;
+  task->idg = task->dataNum;
+  task->data[task->idg] = (union Data*)integer3;
+  task->data[task->idg+1] = (union Data*)integer4;
+  task->maxIdg = task->idg + 2;
+  task->odg = task->maxIdg;
+  task->data[task->odg] = (union Data*)integer5;
+  task->maxOdg = task->odg + 1;
+  // task を登録
+  tasks[1] = task;
+
+  taskManager->contexts = tasks;
+  // goto crateTask1();
+  taskManager->next1 = C_code2;
+  goto meta(context, taskManager->taskManager->TaskManager.spawnTasks);
+}
+```
+
+## taskの配列のspawn
+- taskの配列の要素一つずつをspawn
+
+```
+__code spawnTasksTaskManager(struct TaskManager* taskManager, struct TaskManagerImpl* taskManagerImpl, struct Context** contexts, Code next) {
+    int i = taskManagerImpl->loopCounter->i;
+    struct Context* task = contexts[i];
+    if(i < GET_SIZE(contexts)) {
+        taskManagerImpl->loopCounter->i++;
+        goto taskManager->setWorker(task, taskManager->spawnTasksTaskManager(contexts, next));
+    }
+    taskManagerImpl->loopCounter->i = 0;
+    goto spawnTasksTaskManager1(contexts, next);
+}
+```
+
+## GPU VDI 感想
+- OIST すごい
+- 学科システムにも vGPU ほしいなぁ