Results 1 to 3 of 3

Thread: Reading part of a 2D image

  1. #1

    Reading part of a 2D image

    Hi again,

    I have an 2D OpenCL image. Using a kernel, i modify the values of the first and second channels (x and y), the third and fourth channels are ignored.
    Now, I have to transfer the data from the device to the host.
    Two possibilities:

    - transfer the whole image in a cl_float4* (and consider only .x and .y values)
    - transfer a part of the image in a cl_float2*

    My guess is that the first option should be faster (but I'm not sure) but we use then 2 times more memory on the host than we actually need.
    Conversly, the second option should be longer but we use the exact amount of memory we need.

    Any advice here?
    Thank you,


  2. #2
    Senior Member
    Join Date
    May 2010
    Toronto, Canada

    Re: Reading part of a 2D image

    Why don't you have your kernel write out an image directly instead of using pointers to float? You can create an image with only two channels (CL_RG) where each channel is a single-precision float (CL_FLOAT).

    If you want to use pointers to float instead of images, a pointer to float2 is going to save you 50% of the bandwidth and storage, as you mention. What makes you think it would be slower?
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3

    Re: Reading part of a 2D image

    I didn' t know about CL_RG, that's interesting
    My bad, I should have read the programming guide more carefully


Similar Threads

  1. Replies: 7
    Last Post: 01-21-2011, 01:00 PM

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