Mercurial > hg > GearsTemplate
changeset 487:d6983ce1015d
Fix extern cudainit parameter
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 29 Dec 2017 17:51:36 +0900 |
parents | da1dafcf1a45 |
children | 747dd4ba7b44 |
files | src/parallel_execution/CUDAWorker.cbc src/parallel_execution/context.h src/parallel_execution/cuda.c |
diffstat | 3 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/CUDAWorker.cbc Fri Dec 29 17:16:24 2017 +0900 +++ b/src/parallel_execution/CUDAWorker.cbc Fri Dec 29 17:51:36 2017 +0900 @@ -4,18 +4,19 @@ #interface "Iterator.h" #interface "Queue.h" -extern void cudaInit(struct CUDAWorker *cudaWorker,int phase) ; +extern void cudaInit(struct CUDAWorker *cudaWorker,int phase, int deviceNum); extern void cudaShutdown(CUDAWorker *cudaWorker); static void startCUDAWorker(Worker* worker); -Worker* createCUDAWorker(struct Context* context, int id, Queue* queue, TaskManagerImpl *im) { +Worker* createCUDAWorker(struct Context* context, int id, Queue* queue, int deviceNum) { struct Worker* worker = new Worker(); struct CUDAWorker* cudaWorker = new CUDAWorker(); worker->worker = (union Data*)cudaWorker; worker->tasks = queue; cudaWorker->id = id; cudaWorker->loopCounter = 0; + cudaWorker->deviceNum = deviceNum; worker->taskReceive = C_taskReceiveCUDAWorker; worker->shutdown = C_shutdownCUDAWorker; pthread_create(&worker->thread, NULL, (void*)&startCUDAWorker, worker); @@ -24,8 +25,7 @@ static void startCUDAWorker(Worker* worker) { struct CUDAWorker* cudaWorker = &worker->worker->CUDAWorker; - int deviceNum = 0; - cudaInit(cudaWorker, deviceNum); + cudaInit(cudaWorker, 0, cudaWorker->deviceNum); cudaWorker->context = NEW(struct Context); initContext(cudaWorker->context); cudaWorker->executor = createCUDAExecutor(cudaWorker->context, cudaWorker->device);