Sunday 15 July 2012

memory management - How to pass an array of cl_mem buffers to OpenCL device -


I want to exceed the array of cl_mem buffers in a kernel, though it seems impossible. Someone knows what's the matter here? And if this is really unlikely, how can I achieve that goal when I pass the buffer object to the kernel? thanks a lot.

for kernel

  kernelString = "__cancel zero avct (" + "__ Global Float * x," + "__ Global Float * y," + "__ Global Float * z," + "__ Global Float * vx," + "__ Global Float * vy," + "__ Global Float Vz, "+" ... many logic, "+" __ global float * x2, + "__ global float * y2," + "__ global float * z2," + "__ global float * vx2," + "__ Global Float * vy2," + "__ Global Float * vz2)" + "{" + "... ... +"} "+   

instead of

  CLSetKernelArg (kernel0, 0, sizf.clamm, pointer.To (girisDiz) Isi0Buf); CL.clSetKernelArg (kernel0, 1, sq.m.m., pointer.T.To (viridiGiI buff)); CL.clSetKernelArg (kernel 0, 2, sizefclmM, pointer. T.O. (GERIDIDIZIE 2 buff); CL.clSetKernelArg (kernel0, 3, sizefilm, pointer.To (girisDizisi3Buf)); CL.clSetKernelArg (kernel0, 4, size.claimam, pointer.to (girisDizisi4Buf)); ClSetKernelArg (kernel 0, 5, sizf.claim, pointer.tov (girisDizisi5Buf));   

You can do this with your array in a loop

 for  (int i = 0; i & lt; max; i ++ ) {CL.clSetKernelArg (kernel0, I, size.claim, pointer.tupu (bufferrier [ii])); }   

If you are doing this in the java wrapper, you may need string conjunctivator method to keep the actual arguments in the kernel string. You can also use 2-D logic This should not be string problem in the cover of C / C ++.

No comments:

Post a Comment