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);
--- a/src/parallel_execution/context.h	Fri Dec 29 17:16:24 2017 +0900
+++ b/src/parallel_execution/context.h	Fri Dec 29 17:51:36 2017 +0900
@@ -199,6 +199,7 @@
         struct Context* context;
         int id;
         int loopCounter;
+        int deviceNum;
         struct Queue* tasks;
         int runFlag;
         enum Code next;
--- a/src/parallel_execution/cuda.c	Fri Dec 29 17:16:24 2017 +0900
+++ b/src/parallel_execution/cuda.c	Fri Dec 29 17:51:36 2017 +0900
@@ -2,7 +2,6 @@
 #include <sys/time.h>
 #include <string.h>
 #include <stdlib.h>
-#include <libkern/OSAtomic.h>
 
 // includes, project
 #include <driver_types.h>