cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

sajis997
Adept I

error while mapping pinned memory

Hi forum,

I am creating a pinned memory as follows , but i am getting the error code -36 . Any hint will be very helpful to get around this issue:


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

width = ((getDimension(0) <= 1) ? 1 : getDimension(0)) * getElementSize();

height = 1;

depth = 1;

//calculate the buffer size

bufferSize =

((getDimension(0) <= 1) ? 1 : getDimension(0)) * getElementSize();

//create mem object for the pinned host memory

cl_mem pinnedDeviceMem = clCreateBuffer( cxt->_m_clContext,

CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR,

bufferSize,

NULL,

&errNum);

if( errNum != CL_SUCCESS )

{

osg::notify(osg::FATAL) << __FUNCTION__ << getName() << "[osgOpenCL::Buffer::alloc()] \"" << getName() <<"\": something went wrong while creating the pinned device linear memory for 1D." << std::endl;

return false;

}

//mapp the pinned buffer we have allocated

void *mappedMem = clEnqueueMapBuffer(cxt->_m_clCommandQueue,

*(memory._m_clPinnedDevPtr),

CL_TRUE,

CL_MAP_WRITE,

0,

bufferSize,

0,

NULL,

NULL,

&errNum);

if( errNum != CL_SUCCESS )

{

osg::notify(osg::FATAL) << __FUNCTION__ << getName() << "[osgOpenCL::Buffer::alloc()] \"" << getName() <<"\": something went wrong while mapping the device linear memory for 1D :" << errNum << std::endl;

return false; 

}


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



What might have went wrong up there? I am sure it is havving trouble to map the memory, but do not know why?

Thanks

Sajjad

0 Likes
1 Solution

You can find the meaning of -36 in cl.h file, located in AMDAPP/include/CL/ folder.

Invalid queue should mean the queue variable passed to clEnqueueMapbuffer is invalid. Does the queue and buffer belong to the same context? Probably just check the value of queue variable, before passing it inside the API.

View solution in original post

0 Likes
3 Replies
sajis997
Adept I

I have not got any response over this issue yet.

At least can you guys provide me with some hint how to interpret error codes in OpenCL?

In my case i am getting error code -36 and it is leaving me with no clue.

Looking forward to some hints to get around this error.

Thanks

Sajjadul

0 Likes

Hi folks,

I am getting invalid command queue, at least the following error code is saying so:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Program object initialized.

alloc[osgOpenCL::Buffer::alloc()] "": something went wrong while mapping the device linear memory for 1D :-36

launch OpenCL kernel execution was not successful.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

But the command queue creation is successful. I did not get any error message while creating the command queue.

What else might have went wrong?

Regards

Sajjadul

0 Likes

You can find the meaning of -36 in cl.h file, located in AMDAPP/include/CL/ folder.

Invalid queue should mean the queue variable passed to clEnqueueMapbuffer is invalid. Does the queue and buffer belong to the same context? Probably just check the value of queue variable, before passing it inside the API.

0 Likes