diff TaskManager/Gpu/GpuScheduler.cc @ 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 55f92ed3f244
children bde20cca45ae
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 ;
 }