Mercurial > hg > Members > Moririn
changeset 345:2da00c034fbc
Add waitTask for Add_CodeGear
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 29 May 2017 20:55:07 +0900 |
parents | b8be1d51f002 |
children | 9f8a87389b68 |
files | src/parallel_execution/examples/Add.cbc src/parallel_execution/examples/calc.cbc |
diffstat | 2 files changed, 20 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/examples/Add.cbc Fri May 26 07:39:23 2017 +0900 +++ b/src/parallel_execution/examples/Add.cbc Mon May 29 20:55:07 2017 +0900 @@ -1,5 +1,5 @@ #include "../../context.h" -CodeGear* createAddCodeGear(struct Context* context) { +CodeGear* createAddCodeGear(Context* context) { struct CodeGear* codeGear = new CodeGear(); struct context* addContext = NEW(struct Context); codeGear->codeGear = (union Data*)addContext; @@ -9,7 +9,7 @@ return codeGear; } -CodeGear* setAddCodeGearInfo(struct Context* codeGear, union Data** dataGears) { +CodeGear* setAddCodeGearInfo(Context* codeGear, Data** dataGears) { codeGear->next = C_add; codeGear->idgCount = 2; codeGear->idg = codeGear->datanum; @@ -22,13 +22,20 @@ goto meta(context, C_setWaitTask) } -__code setWaitTask(struct Queue* queue, struct Context* task, Data* data, __code next(...)) { - queue->queue = (Data *)GET_WAIT_LIST(data); - queue->next = next; - queue->data = (Data *)task; - goto meta(context, queue->queue->Queue.put); +__code setWaitTask(Context* codeGear, Queue* Queue, LoopCounter* loopCounter, Data** dataGears, __code next(...)) { + if(loopCounter->i < codeGear->idgCount) { + queue->queue = (Data *)GET_WAIT_LIST(data); + queue->data = codeGears[loopCoutner->i]; + queue->next = C_setWaitTask; + loopCounter->i++; + goto meta(context, queue->queue->Queue.put); + } + taskManager->context = task; + taskManager->next = next; + goto meta(context, taskManager->spawn); } __code setWaitTask_stub(struct Context* context) { - goto setWaitTask(context, Gearef(context, Queue), Gearef(context, TaskManager)->context, Gearef(context, TaskManager)->data, Gearef(context, TaskManager)->next); + Context* codeGear = GearImpl(context, CodeGear, codeGear) + goto setWaitTask(context, codeGear, Gearef(context, Queue), Gearef(codeGear, LoopCounter), Gearef(context, CodeGear)->dataGears, Gearef(context, CodeGear)->next); }
--- a/src/parallel_execution/examples/calc.cbc Fri May 26 07:39:23 2017 +0900 +++ b/src/parallel_execution/examples/calc.cbc Mon May 29 20:55:07 2017 +0900 @@ -133,15 +133,14 @@ int i = loopCounter->i; integer1->value = i; integer2->value = i+1; - codeGear->codeGear= createAdd(context); + + 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 - taskManager->context = task; - taskManager->next = C_createTask1; - goto meta(context, taskManager->taskManager->TaskManager.spawn); - goto meta(context, codeGear->codeGear->CodeGear.); + codeGear->next = C_createTask1; + codeGear->taskManager = taskManager; + goto meta(context, codeGear->codeGear->CodeGear.setInfo); } __code createTask4_stub(struct Context* context) {