Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
15674 Discussions

Getting CL_OUT_OF_RESOURCES with clenqueuewritebuffer API

Altera_Forum
Honored Contributor II
986 Views

Hi, 

I am transferring one 4k frame(3840x2160) from Host to device. My device global memory is 2GB. 

We are creating memory object of size 3968 * 2272. If I am using clcreatebuffer, with CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR flags, its running for all 600 iterations. 

dstPtr1 = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, 3968 * 2272, hostPtr1, &err); 

if ((CL_SUCCESS != err) || (NULL == dstPtr1)) { 

printf("Error in clCreateBuffer dstPtr1 %d\n", err); 

exit(-1); 

 

 

If we are using below, then it's throwing CL_OUT_OF_RESOURCES after 230 iterations even if we release the memory. 

dstPtr1 = clCreateBuffer(context, CL_MEM_READ_ONLY, 3968 * 2272, NULL, &err); 

if ((CL_SUCCESS != err) || (NULL == dstPtr1)) { 

printf("Error in clCreateBuffer dstPtr1 %d\n", err); 

exit(-1); 

err = clEnqueueWriteBuffer(commandQueue[0], dstPtr1, CL_TRUE, 0, 3968 * 2272 * sizeof(pixel), hostPtr1, 0, NULL, NULL); 

if (CL_SUCCESS != err) { 

printf("Error in clEnqueueWriteBuffer dstPtr1 %d\n", err); 

exit(-1); 

What I am not able to understand is both the API calls does the same operation of copying the data from Host to device, but only when I use clEnqueueWriteBuffer I am getting CL_OUT_OF_RESOURCES. Is there any difference between them. 

 

 

Thanks in advance.
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
172 Views

In both the cases, the buffer is created and initialized with data.  

 

You could choose first case if you want create buffer and initialize only once in whole program.  

 

You could use clEnqueueWriteBuffer if you want to update the buffer values with new data set more than once. 

 

I see a size difference in both the cases. You have intialized the buffer with 3968 * 2272 and the you are writing the buffer with 3968 * 2272 *size(pixel). May be you are getting out of order error because of that
Reply