Mercurial > hg > Members > Moririn
changeset 480:39b5df2d1c93
Change loopCounter type from struct LoopCounter to Integer for TaskManagerImpl
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 28 Dec 2017 19:54:28 +0900 |
parents | b8b412a7670a |
children | a517b11c37f7 |
files | src/parallel_execution/TaskManagerImpl.cbc src/parallel_execution/context.h |
diffstat | 2 files changed, 11 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/TaskManagerImpl.cbc Thu Dec 28 19:51:06 2017 +0900 +++ b/src/parallel_execution/TaskManagerImpl.cbc Thu Dec 28 19:54:28 2017 +0900 @@ -30,8 +30,7 @@ taskManagerImpl->sendGPUWorkerIndex = taskManagerImpl->gpu; taskManagerImpl->sendCPUWorkerIndex = taskManagerImpl->cpu; taskManagerImpl->taskCount = 0; - taskManagerImpl->loopCounter = new LoopCounter(); - taskManagerImpl->loopCounter -> i = 0; + taskManagerImpl->loopCounter = 0; createWorkers(context, taskManagerImpl); taskManager->taskManager = (union Data*)taskManagerImpl; return taskManager; @@ -114,13 +113,13 @@ } __code setWaitTaskTaskManagerImpl(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { - int i = taskManager->loopCounter->i; + int i = taskManager->loopCounter; if(task->idg+i < task->maxIdg) { struct Queue* queue = GET_WAIT_LIST(task->data[task->idg + i]); - taskManager->loopCounter->i++; + taskManager->loopCounter++; goto queue->put(task, setWaitTaskTaskManagerImpl); } - taskManager->loopCounter->i = 0; + taskManager->loopCounter = 0; struct Queue* queue = taskManager->taskQueue; goto queue->put(task, incrementTaskCountTaskManagerImpl); } @@ -181,28 +180,28 @@ usleep(1000); goto shutdownTaskManagerImpl(); } - int i = taskManager->loopCounter->i; + int i = taskManager->loopCounter; if (i < taskManager->numWorker) { struct Queue* tasks = taskManager->workers[i]->tasks; goto tasks->put(NULL, shutdownTaskManagerImpl1); } - taskManager->loopCounter->i = 0; + taskManager->loopCounter = 0; goto shutdownTaskManagerImpl2(); } __code shutdownTaskManagerImpl1(struct TaskManagerImpl* taskManager, __code next(...)) { - taskManager->loopCounter->i++; + taskManager->loopCounter++; goto shutdownTaskManagerImpl(); } __code shutdownTaskManagerImpl2(struct TaskManagerImpl* taskManager, __code next(...)) { - int i = taskManager->loopCounter->i; + int i = taskManager->loopCounter; if (i < taskManager->numWorker) { pthread_join(taskManager->workers[i]->thread, NULL); - taskManager->loopCounter->i++; + taskManager->loopCounter++; goto shutdownTaskManagerImpl2(); } - taskManager->loopCounter->i = 0; + taskManager->loopCounter = 0; goto next(...); }
--- a/src/parallel_execution/context.h Thu Dec 28 19:51:06 2017 +0900 +++ b/src/parallel_execution/context.h Thu Dec 28 19:54:28 2017 +0900 @@ -169,7 +169,7 @@ struct Queue* activeQueue; struct Queue* taskQueue; struct Worker** workers; - struct LoopCounter* loopCounter; + int loopCounter; int cpu; int gpu; int io;