I am using the concept of multiple kernels in my work. I created some cl_mem devices which can be used in these kernels. There is the transfer of these memory elements from one kernel to another. THis kernels are executed several times in a loop.

But at last while I am trying to retrieve the data back form GPU to CPU at the end of the process, I am getting an error as CL_MEM_OBJECT_ALLOCATION_FAILURE.

How can I solve this problem? Why this problem occurs?

Thanks in advance.

david.garcia

02-25-2011, 04:06 PM

There is the transfer of these memory elements from one kernel to another.

I don't recommend thinking in those terms. Actual physical data transfers happen between devices, not between kernels.

But at last while I am trying to retrieve the data back form GPU to CPU at the end of the process, I am getting an error as CL_MEM_OBJECT_ALLOCATION_FAILURE.

Can you show us how you are doing this? Is it possible that you are attempting to read a huge amount of data?

Here ckKernelConv is a kernel variable for Convolution, ckKernelAcc is for accumulation fucntion, ckKernelSig is for sigmoid operation and ckKernelimgext is for increasing the size of the image. The kernels are as follows:

What is the value of mem_sizeImage? CL_MEM_OBJECT_ALLOCATION_FAILURE means "we don't have enough device memory to perform this operation".

I don't understand what your program is doing, by the way. This is what I see:

for(int i = 0; i < CNNiterations;i++)
{
Do some stuff here without using cmDevResult;
Copy the contents of cmDevDst into cmDevResult;
}

Read the contents of cmDevResult;

Why write into cmDevResult in every iteration of the loop if you only read after the loop is finished? Why is cmDevResult needed at all? It looks like you could simply read from cmDevDst directly.

GPUworker

02-26-2011, 11:05 AM

I am using the NVIDIA Geforce 9500 GT.

The size of mem_sizeImage = sizeof(float) * 160000.

Even I tried to copy the data from cmDevDst directly at the initial stage. But then also I am getting the same error CL_MEM_OBJECT_ALLOCATION_FAILURE. So I thought there is some mistake and tried to use a new buffer variable cmDevResult. But, the same thing repeats.

david.garcia

02-26-2011, 03:40 PM

This looks so strange. It's not a very big buffer! How do you create cmDevResult? Can you show us the call to clCreateBuffer()?