OpenCL CL_OUT_OF_RESOURCES on event.wait()

as I wrote a bit earlier, allocate the image buffer in the host code and pass it as follows:

cl_uchar* image = new cl_uchar[N*M];

cl::Buffer imageCL( context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, M*N*sizeof(cl_uchar), image, &error);

It is a good habit to refer to different types wit cl_* in the host code, so that it is same size as in the OpenCL kernel code.

as I wrote a bit earlier, allocate the image buffer in the host code and pass it as follows:

cl_uchar* image = new cl_uchar[N*M];

cl::Buffer imageCL( context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, M*N*sizeof(cl_uchar), image, &error);

It is a good habit to refer to different types wit cl_* in the host code, so that it is same size as in the OpenCL kernel code.

Oh. That did you mean. I already tried it and it was no solution.

The error just happens when I change one or more array-values in my CL C code.

Oh. That did you mean. I already tried it and it was no solution.

The error just happens when I change one or more array-values in my CL C code.

never mind, than try out to pass m and n as integer kernel parameters. Also try out to change private arrays

float c0[2];

    float c[2];

    float d[2];

to vectors and index them accordingly

float4 c0; //access it like c0.x - previous c0[0], c0.y - alias c0[1]

float4 c, d;

I’m not sure how much NVidia supports arrays in private space…

never mind, than try out to pass m and n as integer kernel parameters. Also try out to change private arrays

float c0[2];

    float c[2];

    float d[2];

to vectors and index them accordingly

float4 c0; //access it like c0.x - previous c0[0], c0.y - alias c0[1]

float4 c, d;

I’m not sure how much NVidia supports arrays in private space…

With these variables is no problem at all.

The failure just occures when I change “image”.

Do I possibly handle that array in a wrong way?

With these variables is no problem at all.

The failure just occures when I change “image”.

Do I possibly handle that array in a wrong way?

Yes, you handle it in wrong way (I must have been blinded that I didn’t see it before). You declared it as an array of unsigned chars (cl_uchar is 8-bit), but you are assigning in that array integer values (cl_int 32-bit values). Make the types to be the same.

Yes, you handle it in wrong way (I must have been blinded that I didn’t see it before). You declared it as an array of unsigned chars (cl_uchar is 8-bit), but you are assigning in that array integer values (cl_int 32-bit values). Make the types to be the same.

Now I tried an explicit typecast:

image[index++] = (unsigned char)(255 * k);

but its still the same error.

Now I tried an explicit typecast:

image[index++] = (unsigned char)(255 * k);

but its still the same error.

strange, just make sure and declare the array as cl_int rather than explicit cast - I know it should be the same, but lets make really sure…

strange, just make sure and declare the array as cl_int rather than explicit cast - I know it should be the same, but lets make really sure…

I tried it, but its still the same…

/** Allocate image buffer **/

    cl_int image2[M*N];

    int h = 0;

    for(int i = 0; i < M; i++)

	for(int j = 0; j < N; j++)

	{

	    image2[h] = (cl_int)image[i][j];

	    h++;

	}

    cl::Buffer imageCL( context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, M*N*sizeof(cl_int/*cl_uchar*/), image2, &error);

    checkErr(error, "Buffer::outCL(image)");

/*****/

I tried it, but its still the same…

/** Allocate image buffer **/

    cl_int image2[M*N];

    int h = 0;

    for(int i = 0; i < M; i++)

	for(int j = 0; j < N; j++)

	{

	    image2[h] = (cl_int)image[i][j];

	    h++;

	}

    cl::Buffer imageCL( context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, M*N*sizeof(cl_int/*cl_uchar*/), image2, &error);

    checkErr(error, "Buffer::outCL(image)");

/*****/

also there is missing any cl::CommandQueue::enqueueCopyBuffer if you still pass buffers instead of simply variables to the kernel

also there is missing any cl::CommandQueue::enqueueCopyBuffer if you still pass buffers instead of simply variables to the kernel

I found a description on

http://openclcomputing.com/src/doxygen/opencl1_0_rev45_cpp/classcl_1_1_command_queue.html#d46d201111102942d77a98c9a11a631b

but I still don’t know what to do.

What is my destination buffer?

I found a description on

http://openclcomputing.com/src/doxygen/opencl1_0_rev45_cpp/classcl_1_1_command_queue.html#d46d201111102942d77a98c9a11a631b

but I still don’t know what to do.

What is my destination buffer?