Mercurial > hg > Papers > 2021 > soto-thesis
view prepaper/src/sendTask.cbc @ 14:a63df15c9afc default tip
DONE
author | soto <soto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 15 Feb 2021 23:36:39 +0900 |
parents | 3dba680da508 |
children |
line wrap: on
line source
__code spawnTaskManagerImpl(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { if (task->idgCount == 0) { goto taskSend(); } goto next(...); } __code taskSend(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { if (task->gpu) { goto taskSend1(); } else { 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; } 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; } struct Queue* queue = taskManager->workers[workerId]->tasks; goto queue->put(task, next(...)); }