Results 1 to 2 of 2

Thread: Buffer Offsets are not allowed in OpenCL

  1. #1

    Buffer Offsets are not allowed in OpenCL

    Hi forum,

    I found this statement in the following link :

    Could some one explain what it means ?


  2. #2
    Hi Sajjadul,

    As far as I understand, the comment refers to the differences between memory allocation concepts between OpenCL and CUDA.

    In CUDA, cudaMalloc API call returns a pointer. This pointer is a device pointer, representing the allocated buffer on the device's memory. You can't use this pointer for direct access from the host - it can be used only by CUDA API calls such as cudaMemcpy,or by a kernel running on the device. However, You can do pointer arithmetics on it before providing it to a CUDA API or a kernel - add, subtract, etc. for example, you can send a pointer with an offset to the kernel.

    In OpenCL, on the other side, the clCreateBuffer returns cl_mem. This is an opaque handler, which represents the buffer. Since it is not a pointer, you can't do pointer arithmetics on it. However, you can do something similar to CUDA's functionality by creating a sub-buffer from this buffer. The sub-buffer creation API enables you to define an offset from the beginning of the parent buffer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean