diff src/parallel_execution/cuda.c @ 451:dcc42f3e7e97

Auto choice blockDim
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Tue, 05 Dec 2017 06:33:40 +0900
parents 08a93fc2f0d3
children d6983ce1015d
line wrap: on
line diff
--- a/src/parallel_execution/cuda.c	Mon Dec 04 04:24:30 2017 +0900
+++ b/src/parallel_execution/cuda.c	Tue Dec 05 06:33:40 2017 +0900
@@ -51,7 +51,7 @@
     struct Queue* tasks;
     int runFlag;
     int next;
-    int num_stream;
+    int numStream;
     CUstream *stream;
 } CUDAWorker;
 
@@ -67,14 +67,14 @@
 } Array;
 */
 
-void cudaInit(struct CUDAWorker *cudaWorker,int phase) {
+void cudaInit(struct CUDAWorker *cudaWorker,int phase, int deviceNum) {
     // initialize and load kernel
-    cudaWorker->num_stream = 1; // number of stream
-    //    cudaWorker->stream = NEWN(cudaWorker->num_stream, CUstream );
+    cudaWorker->numStream = 1; // number of stream
+    //    cudaWorker->stream = NEWN(cudaWorker->numStream, CUstream );
     if (phase==0)
         checkCudaErrors(cuInit(0));
     if (phase==0)
-        checkCudaErrors(cuDeviceGet(&cudaWorker->device, 0));
+        checkCudaErrors(cuDeviceGet(&cudaWorker->device, deviceNum));
     if (phase==0)
         checkCudaErrors(cuCtxCreate(&cudaWorker->cuCtx, CU_CTX_SCHED_SPIN, cudaWorker->device));
     //    if (cudaWorker->num_stream) {