- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page