Mercurial > hg > GearsTemplate
changeset 522:bc1616e1e172
Delete for unused struct Context member
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 16 Jan 2018 16:38:16 +0900 |
parents | 393e1d2d06f2 |
children | e28e3bd6b181 |
files | doc/semaphoreSequence.graffle src/parallel_execution/TaskManagerImpl.cbc src/parallel_execution/context.h src/parallel_execution/examples/boundedBuffer/BoundedBuffer.cbc src/parallel_execution/examples/boundedBuffer/main.cbc |
diffstat | 5 files changed, 26 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/TaskManagerImpl.cbc Wed Jan 10 23:13:51 2018 +0900 +++ b/src/parallel_execution/TaskManagerImpl.cbc Tue Jan 16 16:38:16 2018 +0900 @@ -148,18 +148,29 @@ __code taskSend(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { // set workerId if (task->gpu) { - task->workerId = taskManager->sendGPUWorkerIndex; - if(++taskManager->sendGPUWorkerIndex >= taskManager->cpu) { - taskManager->sendGPUWorkerIndex = taskManager->gpu; - } + goto taskSend1(); } else { - task->workerId = taskManager->sendCPUWorkerIndex; - if(++taskManager->sendCPUWorkerIndex >= taskManager->maxCPU) { - taskManager->sendCPUWorkerIndex = taskManager->cpu; - } + goto taskSend2(); + } +} + +__code taskSend1(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { + int workerId = taskManager->sendGPUWorkerIndex; + if(++taskManager->sendGPUWorkerIndex >= taskManager->cpu) { + taskManager->sendGPUWorkerIndex = taskManager->gpu; } pthread_mutex_unlock(&taskManager->mutex); - struct Queue* queue = taskManager->workers[task->workerId]->tasks; + struct Queue* queue = taskManager->workers[workerId]->tasks; + goto queue->put(task, next(...)); +} + +__code taskSend2(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { + int workerId = taskManager->sendCPUWorkerIndex; + if(++taskManager->sendCPUWorkerIndex >= taskManager->maxCPU) { + taskManager->sendCPUWorkerIndex = taskManager->cpu; + } + pthread_mutex_unlock(&taskManager->mutex); + struct Queue* queue = taskManager->workers[workerId]->tasks; goto queue->put(task, next(...)); }
--- a/src/parallel_execution/context.h Wed Jan 10 23:13:51 2018 +0900 +++ b/src/parallel_execution/context.h Tue Jan 16 16:38:16 2018 +0900 @@ -96,16 +96,18 @@ struct TaskManager* taskManager; int codeNum; __code (**code) (struct Context*); + union Data **data; void* heapStart; void* heap; long heapLimit; int dataNum; + + // task parameter int idgCount; //number of waiting dataGear int idg; int maxIdg; int odg; int maxOdg; - int workerId; int gpu; // GPU task struct Context* task; struct Element* taskList; @@ -114,8 +116,6 @@ CUmodule module; CUfunction function; #endif - union Data **data; - /* multi dimension parameter */ int iterate; struct Iterator* iterator;
--- a/src/parallel_execution/examples/boundedBuffer/BoundedBuffer.cbc Wed Jan 10 23:13:51 2018 +0900 +++ b/src/parallel_execution/examples/boundedBuffer/BoundedBuffer.cbc Tue Jan 16 16:38:16 2018 +0900 @@ -46,6 +46,7 @@ __code putBoundedBuffer4(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { goto next(...); } + __code takeBoundedBuffer(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) { struct Semaphore* semaphore = buffer->fullCount; goto semaphore->p(takeBoundedBuffer1);
--- a/src/parallel_execution/examples/boundedBuffer/main.cbc Wed Jan 10 23:13:51 2018 +0900 +++ b/src/parallel_execution/examples/boundedBuffer/main.cbc Tue Jan 16 16:38:16 2018 +0900 @@ -54,6 +54,8 @@ *len = length; par goto producer(buffer, len, __exit); par goto producer(buffer, len, __exit); + par goto producer(buffer, len, __exit); + par goto consumer(buffer, len, __exit); par goto consumer(buffer, len, __exit); par goto consumer(buffer, len, __exit); par goto initBuffer(buffer, len, __exit);