Mercurial > hg > GearsTemplate
comparison src/parallel_execution/TaskManagerImpl.cbc @ 319:a15511b1a6e0
separate cuda.c, and USE_CUDA_MAIN_THREAD flag
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 15 Feb 2017 20:43:55 +0900 |
parents | 51aa65676e37 |
children | f23f6d0aa4e9 |
comparison
equal
deleted
inserted
replaced
318:054c47e6ca20 | 319:a15511b1a6e0 |
---|---|
33 taskManagerImpl->workers[i] = (Worker*)createCPUWorker(context, i, queue); | 33 taskManagerImpl->workers[i] = (Worker*)createCPUWorker(context, i, queue); |
34 } | 34 } |
35 for (;i<taskManager->cpu;i++) { | 35 for (;i<taskManager->cpu;i++) { |
36 #ifdef USE_CUDAWorker | 36 #ifdef USE_CUDAWorker |
37 Queue* queue = createSynchronizedQueue(context); | 37 Queue* queue = createSynchronizedQueue(context); |
38 // taskManagerImpl->workers[i] = (Worker*)createCUDAWorker(context, i, queue,0); | 38 #ifndef USE_CUDA_MAIN_THREAD |
39 taskManagerImpl->workers[i] = (Worker*)createCUDAWorker(context, i, queue,0); | |
40 #else | |
39 taskManagerImpl->workers[i] = (Worker*)queue; | 41 taskManagerImpl->workers[i] = (Worker*)queue; |
42 #endif | |
40 #else | 43 #else |
41 Queue* queue = createSynchronizedQueue(context); | 44 Queue* queue = createSynchronizedQueue(context); |
42 taskManagerImpl->workers[i] = (Worker*)createCPUWorker(context, i, queue); | 45 taskManagerImpl->workers[i] = (Worker*)createCPUWorker(context, i, queue); |
43 #endif | 46 #endif |
44 } | 47 } |
47 taskManagerImpl->workers[i] = (Worker*)createCPUWorker(context, i, queue); | 50 taskManagerImpl->workers[i] = (Worker*)createCPUWorker(context, i, queue); |
48 } | 51 } |
49 } | 52 } |
50 | 53 |
51 __code createTask(struct TaskManager* taskManager) { | 54 __code createTask(struct TaskManager* taskManager) { |
52 TaskManager *t = (TaskManager *)taskManager->taskManager; | |
53 TaskManagerImpl *im = (TaskManagerImpl *)t->taskManager; | |
54 | |
55 taskManager->context = NEW(struct Context); | 55 taskManager->context = NEW(struct Context); |
56 initContext(taskManager->context); | 56 initContext(taskManager->context); |
57 taskManager->context->taskManager = taskManager; | 57 taskManager->context->taskManager = taskManager; |
58 struct Queue* tasks = im->workers[0]->tasks; | |
59 goto meta(context, C_setWorker); | 58 goto meta(context, C_setWorker); |
60 } | 59 } |
61 | 60 |
62 __code setWorker(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { | 61 __code setWorker(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { |
63 task->workerId = taskManager->sendWorkerIndex; | 62 task->workerId = taskManager->sendWorkerIndex; |