changeset 1460:d79256b51d7f draft

debug GpuRunTest.
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Tue, 12 Jun 2012 13:18:03 +0900
parents d62b5d9faba0
children bde20cca45ae
files TaskManager/Gpu/GpuScheduler.cc TaskManager/test/GpuRegistTaskTest/Makefile TaskManager/test/GpuRunTest/Makefile
diffstat 3 files changed, 30 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc	Tue Jun 12 05:59:45 2012 +0900
+++ b/TaskManager/Gpu/GpuScheduler.cc	Tue Jun 12 13:18:03 2012 +0900
@@ -17,6 +17,31 @@
 
 static int
 schedrun(SchedTask *smanager, void *rbuf, void *wbuf){
+
+    cl_int ret = gputhreads->ret;
+    cl_context context = gputhreads->context;
+    cl_command_queue command_queue = gputhreads->command_queue;
+    long count = (long)s->get_param(0);
+    
+    for(int c = 0; c<count; c++) {
+        length = (long)s->get_param(c+1);
+        
+        cl_mem memobj  = clCreateBuffer(context, CL_MEM_READ_WRITE,
+                                        sizeof(int)*length, NULL, &ret);
+        
+        ret = clEnqueueWriteBuffer(command_queue, memobj, CL_TRUE, 0,
+                                   sizeof(int)*length, s->get_input(rbuf, c), 0, NULL, NULL);
+        
+        clSetKernelArg(kernel, c, sizeof(cl_mem), (void *)&memobj);
+    }
+    
+    cl_kernel kernel = *(task_list[cmd].kernel);
+    cl_event ev;
+    clEnqueueTask(command_queue, kernel, 0, NULL,  &ev);
+    
+    clReleaseCommandQueue(command_queue);
+    clReleaseContext(context);
+    clReleaseKernel(kernel);
     return 0 ;
 }
 
--- a/TaskManager/test/GpuRegistTaskTest/Makefile	Tue Jun 12 05:59:45 2012 +0900
+++ b/TaskManager/test/GpuRegistTaskTest/Makefile	Tue Jun 12 13:18:03 2012 +0900
@@ -2,7 +2,7 @@
 
 CPPFLAGS += -g -Wall -I../../../include/TaskManager -m$(ABIBIT)
 
-TARGET=GpuRegistTask-Test
+TARGET=GpuRegistTaskTest
 
 
 
--- a/TaskManager/test/GpuRunTest/Makefile	Tue Jun 12 05:59:45 2012 +0900
+++ b/TaskManager/test/GpuRunTest/Makefile	Tue Jun 12 13:18:03 2012 +0900
@@ -5,10 +5,7 @@
 SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
 OBJS = $(SRCS:.cc=.o)
 
-TASK_DIR  = ../../Gpu
-TASK_OBJS = $(wildcard $(TASK_DIR)/*.o)
-
-LIBS += ../../libGpuManager.a -framework opencl `sdl-config --cflags`
+LIBS += ../../libGpuManager.a `sdl-config --cflags` -framework opencl 
 
 .SUFFIXES: .cc .o
 
@@ -17,16 +14,16 @@
 
 all: $(TARGET)
 
-$(TARGET): $(OBJS) $(TASK_OBJS)
+$(TARGET): $(OBJS)
 	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
 
 link:
-	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+	$(CC) -o $(TARGET) $(OBJS) $(LIBS)
 
 debug: $(TARGET)
 	sudo gdb ./$(TARGET) 
 
 clean:
-	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f $(TARGET) $(OBJS)
 	rm -f *~ \#*