I have a kernel defined like this:
Code :
kernel void trivial_kmean(global float* points, global float* centroids, global int* closestCentroid , const int clusters, const int pts, const int dimensions) {...}
Kernel and buffer creation is successful but when I'm trying to set memory objects as kernel parameters CL_INVALID_MEM_OBJECT occurs.
Buffers definition:
Code :
cl_mem centroids, points, closestCentroids;
points = clCreateBuffer(context, CL_MEM_READ_ONLY , sizeof(float) * dimensions * pts, NULL, &bufferCreationError);
centroids = clCreateBuffer(context, CL_MEM_READ_ONLY , sizeof(float) * dimensions * clusters, NULL, &bufferCreationError);
closestCentroids = clCreateBuffer(context, CL_MEM_WRITE_ONLY, sizeof(int) * pts,	NULL, &bufferCreationError);
Parameter setting:
Code :
setArgumentError = clSetKernelArg(k, 0, sizeof(cl_mem), &points);
setArgumentError = clSetKernelArg(k, 1, sizeof(cl_mem), &centroids);
setArgumentError = clSetKernelArg(k, 2, sizeof(cl_mem), &closestCentroids);
I can not find the cause of this error
Please help me!