comparison 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
comparison
equal deleted inserted replaced
1459:d62b5d9faba0 1460:d79256b51d7f
15 connector = fifoDmaManager; 15 connector = fifoDmaManager;
16 } 16 }
17 17
18 static int 18 static int
19 schedrun(SchedTask *smanager, void *rbuf, void *wbuf){ 19 schedrun(SchedTask *smanager, void *rbuf, void *wbuf){
20
21 cl_int ret = gputhreads->ret;
22 cl_context context = gputhreads->context;
23 cl_command_queue command_queue = gputhreads->command_queue;
24 long count = (long)s->get_param(0);
25
26 for(int c = 0; c<count; c++) {
27 length = (long)s->get_param(c+1);
28
29 cl_mem memobj = clCreateBuffer(context, CL_MEM_READ_WRITE,
30 sizeof(int)*length, NULL, &ret);
31
32 ret = clEnqueueWriteBuffer(command_queue, memobj, CL_TRUE, 0,
33 sizeof(int)*length, s->get_input(rbuf, c), 0, NULL, NULL);
34
35 clSetKernelArg(kernel, c, sizeof(cl_mem), (void *)&memobj);
36 }
37
38 cl_kernel kernel = *(task_list[cmd].kernel);
39 cl_event ev;
40 clEnqueueTask(command_queue, kernel, 0, NULL, &ev);
41
42 clReleaseCommandQueue(command_queue);
43 clReleaseContext(context);
44 clReleaseKernel(kernel);
20 return 0 ; 45 return 0 ;
21 } 46 }
22 47
23 void 48 void
24 GpuScheduler::run() 49 GpuScheduler::run()