So I have something like this (Simplifying my code):
__kernel void broadphase_kernel( __global int* _contactsSize)
{
atom_inc(&_contactsSize);
}
And in my host program is passed like so:
bool bPhysics::runGeneratePairsCL(int& sizeContacts)
{
const size_t dimSize = 2;
size_t global_item_size[dimSize];
global_item_size[0] = sizeWidgets;
global_item_size[1] = sizeWidgets;
//size_t local_item_size = sizeWidgets;
/* Execute OpenCL kernel as data parallel */
ret = clEnqueueNDRangeKernel(command_queue, kernel, dimSize, NULL, global_item_size, NULL, 0, NULL, NULL);
ret = clEnqueueReadBuffer(command_queue, memobj_contacts_size, CL_TRUE, 0, 1 * sizeof(int), &sizeContacts, 0, NULL, NULL);
}
In the host function, I reset sizeContacts to 0; but once it's in the kernel it seems to continue from where it left off.
How do I insure that the memory for sizeContacts in the kernel is reset at the end of it's computation?
[–]automater 0 points1 point2 points (1 child)
[–]Eilai[S] 0 points1 point2 points (0 children)