4 Replies Latest reply on Aug 20, 2013 7:36 AM by sajis997

    error while mapping pinned memory

    sajis997

      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

        • Re: error while mapping pinned memory
          sajis997

          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

            • Re: error while mapping pinned memory
              sajis997

              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