Hi All,
I have a scenario like shown in the following code
The arguments of the kernel vary with the iterator
for(Iterator = 0; Iterator < 20 ; Iterator++)
{
clSetKernelArg();//argument 1
clSetKernelArg();//argument 2
clEnqueueNDRangeKernel( CommandQueue ,kernel, 2 , NULL, &GlobalSize......)
clfinish(CommandQueue );
}
I tried changing the code above code to increase the performance at cpu level
for(Iterator = 0; Iterator < 20 ; Iterator++)
{
clSetKernelArg();//argument 1
clSetKernelArg();//argument 2
clEnqueueNDRangeKernel( CommandQueue ,kernel, 2 , NULL, &GlobalSize......)
}
clfinish(CommandQueue );
But my buffers are not updated properly. What might be the reason?
Please help me…
Thanks & Regards
Did you create your command queue with out-of-order execution? Otherwise the problem is unlikely to be in the code you have showed us.
Also, how do you know your buffers are not updated properly? How do you read their content?
Dear David,
I created the Commandqueue using “clCreateCommandQueue”, the order of execution is default.
Argument 2 is same memory object for all iterations, does that effect the execution.
I am reading back the buffers (memory objects) using clEnqueueReadBuffer once the for loop ends as shown below
for(Iterator = 0; Iterator < 20 ; Iterator++)
{
clSetKernelArg();//argument 1
clSetKernelArg();//argument 2 is same memory object for all iterations
clEnqueueNDRangeKernel( CommandQueue ,kernel, 2 , NULL, &GlobalSize......)
}
clfinish(CommandQueue );
for(Iterator = 0; Iterator < 20 ; Iterator++)
{
clEnqueueReadBuffer();// memory object depends on iterator
clFinish(CommandQueue);
/* FILE WRITING */
}
Thanks & Regards
None of those calls to clFinish() seem necessary.
The problem may be caused to the arguments passed to clEnqueueNDRangeKernel() or to the arguments passed to clEnqueueReadBuffer().
Can you write a small program that reproduces this problem and that you can share with us in complete form?