Mercurial > hg > Members > Moririn
changeset 343:5065d1e4adbb
Merge
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 25 May 2017 22:52:54 +0900 |
parents | de1e315379c6 (diff) 54bfd016ad88 (current diff) |
children | b8be1d51f002 |
files | |
diffstat | 5 files changed, 33 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/CMakeLists.txt Tue May 09 17:05:12 2017 +0900 +++ b/src/parallel_execution/CMakeLists.txt Thu May 25 22:52:54 2017 +0900 @@ -67,7 +67,7 @@ TARGET calc SOURCES - examples/calc.cbc RedBlackTree.cbc compare.c SingleLinkedStack.cbc CPUWorker.cbc time.cbc twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc SemaphoreImpl.cbc + examples/calc.cbc SingleLinkedStack.cbc CPUWorker.cbc time.cbc twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc SemaphoreImpl.cbc ) if (${USE_CUDA})
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parallel_execution/CodeGear.cbc Thu May 25 22:52:54 2017 +0900 @@ -0,0 +1,9 @@ +typedef struct CodeGear<Impl>{ + union Data* codeGear; + enum Code code; + __code run(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)); + struct Integer* input1; + struct Integer* input2; + struct Integer* output; + __code next(...); +} CodeGear;
--- a/src/parallel_execution/Semaphore.cbc Tue May 09 17:05:12 2017 +0900 +++ b/src/parallel_execution/Semaphore.cbc Thu May 25 22:52:54 2017 +0900 @@ -4,4 +4,3 @@ __code v(Impl* semaphore, __code next(...)); __code next(...); } Semaphore; -
--- a/src/parallel_execution/context.h Tue May 09 17:05:12 2017 +0900 +++ b/src/parallel_execution/context.h Thu May 25 22:52:54 2017 +0900 @@ -109,6 +109,13 @@ struct LoopCounter { int i; } LoopCounter; + struct Task { + union Data* task; + enum Code code; + int idgCount; + int odgCount; + enum Code setTaskInfo; + } Task; struct TaskManager { #ifdef USE_CUDA_MAIN_THREAD volatile @@ -174,11 +181,6 @@ enum Code next; struct Queue* args; } Main; - struct Task { - enum Code code; - struct Queue* dataGears; - int idsCount; - } Task; // Queue Interface struct Queue { union Data* queue;
--- a/src/parallel_execution/examples/calc.cbc Tue May 09 17:05:12 2017 +0900 +++ b/src/parallel_execution/examples/calc.cbc Thu May 25 22:52:54 2017 +0900 @@ -101,25 +101,14 @@ loopCounter->i = 0; taskManager->next = C_code1; - sleep(3); goto meta(context, taskManager->taskManager->TaskManager.shutdown); } __code createTask2(LoopCounter* loopCounter, TaskManager* taskManager, struct Context *task, Integer *integer1, Integer *integer2, Integer *integer3) { int i = loopCounter->i; - task->idgCount = 1; - task->next = C_mult; integer2->value = i; - 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->task = task; - taskManager->next = C_createTask3; - taskManager->data = (union Data*)integer1; - goto meta(context, taskManager->taskManager->TaskManager.setWaitTask); + par goto mult(integer1, integer2, integer3, _exit); + goto createTask3; } __code createTask2_stub(struct Context* context) { @@ -147,16 +136,17 @@ __code createTask5(LoopCounter* loopCounter, TaskManager* taskManager, struct Context* task, Integer *integer1, Integer *integer2, Integer *integer3) { int i = loopCounter->i; + integer1->value = i; + integer2->value = i+1; task->next = C_add; task->idgCount = 0; - integer1->value = i; - integer2->value = i+1; 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_createTask1; goto meta(context, taskManager->taskManager->TaskManager.spawn); } @@ -197,29 +187,29 @@ goto start_code(main_context); } -__code add(struct Integer* input1, struct Integer* input2, struct Integer* output) { - output->value = input1->value + input2->value; - printf("%d + %d = %d\n", input1->value, input2->value, output->value); - goto meta(context, context->next); +__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 meta(context, context->next); } -__code add_stub(struct Context* context) { - goto add(context, +__code add_stub(struct Context* context) { + goto add(context, &context->data[context->idg]->Integer, &context->data[context->idg + 1]->Integer, &context->data[context->odg]->Integer); } -__code mult(struct Integer* input1, struct Integer* input2, struct Integer* output) { - output->value = input1->value * input2->value; - printf("%d * %d = %d\n", input1->value, input2->value, output->value); +__code mult(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); assert(output->value == 2 * (input2->value * input2->value) + input2->value); goto meta(context, context->next); } -__code mult_stub(struct Context* context) { - goto mult(context, +__code mult_stub(struct Context* context) { + goto mult(context, &context->data[context->idg]->Integer, &context->data[context->idg + 1]->Integer, &context->data[context->odg]->Integer);