Mercurial > hg > GearsTemplate
changeset 222:77faa28128b4
Add taskSend for TaskManager
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 11 Jan 2017 16:52:27 +0900 |
parents | 2454f4392316 |
children | 8d2519c3a36e |
files | src/parallel_execution/context.h src/parallel_execution/taskManager.c src/parallel_execution/test/queue_test.c src/parallel_execution/worker.c |
diffstat | 4 files changed, 29 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/context.h Mon Jan 09 21:39:33 2017 +0900 +++ b/src/parallel_execution/context.h Wed Jan 11 16:52:27 2017 +0900 @@ -92,7 +92,7 @@ struct Context* contexts; enum Code execute; enum Code taskSend; - enum Code taskRecive; + enum Code taskReceive; enum Code shutdown; struct Queue* tasks; } Worker;
--- a/src/parallel_execution/taskManager.c Mon Jan 09 21:39:33 2017 +0900 +++ b/src/parallel_execution/taskManager.c Wed Jan 11 16:52:27 2017 +0900 @@ -38,6 +38,15 @@ ); } +__code taskSend(struct Context* context) { + if(loopCounter->i < taskManager->numWorker) { + taskManager->workers[i]->taskSend; + loopCounter->i++; + goto meta(context, C_taskSend); + } + goto meta(context, TaskManager->next); +} + __code shutdownTaskManager(struct Context* context, struct LoopCounter* loopCounter, struct Worker* worker) { int i = loopCounter->i;
--- a/src/parallel_execution/test/queue_test.c Mon Jan 09 21:39:33 2017 +0900 +++ b/src/parallel_execution/test/queue_test.c Wed Jan 11 16:52:27 2017 +0900 @@ -33,7 +33,7 @@ __code queueTest2_stub(struct Context* context) { SingleLinkedQueue* singleLinkedQueue = &context->data[D_Queue]->Queue.queue->Queue.queue->SingleLinkedQueue; - assert(singleLinkedQueue->top->data->Task.code == C_queueTest1); + assert(singleLinkedQueue->top->data->Task.code == C_queueTest2); assert(singleLinkedQueue->last->data->Task.code == C_queueTest1); Task* task = &ALLOCATE(context, Task)->Task; goto queueTest2(context,
--- a/src/parallel_execution/worker.c Mon Jan 09 21:39:33 2017 +0900 +++ b/src/parallel_execution/worker.c Wed Jan 11 16:52:27 2017 +0900 @@ -5,13 +5,27 @@ union Data* createWorker(struct Context* context) { struct Worker* worker = &ALLOCATE(context, Worker)->Worker; - // worker->execute = C_executeWorker; - // worker->taskSend = C_taskSendWorker; - // worker->taskRecive = C_taskReciveWorker; - // worker->shutdown = C_shutdownWorker; + worker->execute = C_executeWorker; + worker->taskSend = C_taskSendWorker; + worker->taskReceive = C_taskReceiveWorker; + worker->shutdown = C_shutdownWorker; return (union Data*)(worker); } +__code taskSend(struct Context* context) { +} + +__code exectureWorker(struct Context* context) { + worker->next = worker->taskReceive; + goto meta(context, task->code); +} + +__code taskReceive(struct Context* context) { + queue->queue = (union Data*)worker->worker->Worker.tasks; + queue->next = worker->execute; + goto meta(context, queue->queue->Queue.take); +} + __code getTask1(struct Context* context, struct Queue* queue) { queue->next = C_getTask2; goto meta(context, queue->take);