Modified CUDA hello example to use current version of GPU Manager.
authorLukasz Wesolowski <wesolwsk@illinois.edu>
Sat, 31 Dec 2011 07:14:33 +0000 (01:14 -0600)
committerLukasz Wesolowski <wesolwsk@illinois.edu>
Sat, 31 Dec 2011 07:14:33 +0000 (01:14 -0600)
examples/charm++/cuda/hello/Makefile
examples/charm++/cuda/hello/helloCUDA.cu

index 071e8dd0d476c35b6c5c8440b29af50a23cf0749..dca7a6081c0b57f26108a1f35b3755f58fa33fa6 100644 (file)
@@ -4,11 +4,9 @@ OBJS = hello.o helloCUDA.o
 
 NVCC = /usr/local/cuda/bin/nvcc 
 NVCC_FLAGS = -c -use_fast_math #-device-debug -deviceemu 
-NVCC_INC = -I/usr/local/cuda/include -I../../../../../NVIDIA_CUDA_SDK/common/inc
-
-LD_LIBS += -lcuda -lcudart -lGL -lGLU -lcutil
-
-export LD_RUN_PATH = /usr/local/cuda/lib
+NVCC_INC = -I/usr/local/cuda/include 
+CHARMINC = -I../../../../include
+LD_LIBS += -lcuda -lcudart 
 
 all: hello
 
@@ -19,14 +17,13 @@ hello.decl.h: hello.ci
        $(CHARMC)  hello.ci
 
 clean:
-       rm -f *.decl.h *.def.h conv-host *.o wr.h hello charmrun
+       rm -f *.decl.h *.def.h conv-host *.o hello charmrun
 
 hello.o: hello.C hello.decl.h
-       $(CHARMC) -g -c hello.C
+       $(CHARMC) -c hello.C
 
 helloCUDA.o: helloCUDA.cu
-       cp ../../../../src/arch/cuda/hybridAPI/wr.h .
-       $(NVCC) -g $(NVCC_FLAGS) $(NVCC_INC) helloCUDA.cu
+       $(NVCC) $(NVCC_FLAGS) $(NVCC_INC) $(CHARMINC) helloCUDA.cu
 
 test: all
        ./charmrun hello +p4 10
index 69a15784366f1740ab7d522618c2b6a75d8cea7b..1e929788241a4bced05a6f3c2c18aab0a110795b 100644 (file)
@@ -9,32 +9,16 @@ __global__ void helloKernel() {
 }
 
 void kernelSetup(void *cb) {
-  workRequest *wr; 
-  wr = (workRequest*) malloc(sizeof(workRequest)); 
+  workRequest wr; 
+  wr.dimGrid = dim3(1, 1);
+  wr.dimBlock = dim3(1,1);
+  wr.smemSize = 0;
+  wr.nBuffers = 0; 
+  wr.bufferInfo = NULL;
+  wr.callbackFn = cb; 
+  wr.id = 0; 
 
-  wr->dimGrid.x = 1; 
-  wr->dimBlock.x = 1; 
-  wr->smemSize = 0;
-  
-  wr->readWriteDevicePtr = NULL;
-  wr->readWriteHostPtr = NULL; 
-  wr->readWriteLen = 0; 
-
-  wr->readOnlyDevicePtr = NULL;
-  wr->readOnlyHostPtr = NULL;
-  wr->readOnlyLen = 0; 
-
-  wr->writeOnlyDevicePtr = NULL;
-  wr->writeOnlyHostPtr = NULL;
-  wr->writeOnlyLen = 0; 
-
-  wr->callbackFn = cb; 
-
-  wr->id = 0; 
-
-  wr->executing = 0; 
-
-  enqueue(wrQueue, wr); 
+  enqueue(wrQueue, &wr); 
 
 }
 
@@ -43,7 +27,7 @@ void kernelSelect(workRequest *wr) {
   switch (wr->id) {
   case 0: 
     printf("calling kernel\n"); 
-    helloKernel<<<wr->dimGrid,wr->dimBlock,wr->smemSize>>>();
+    helloKernel<<<wr->dimGrid,wr->dimBlock,wr->smemSize, kernel_stream>>>();
     break;
   default:
     printf("error: id %d not valid\n", wr->id);