Results 1 to 3 of 3

Thread: how to set a buffer's memory to 0

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    5

    how to set a buffer's memory to 0

    how can i set a buffer's associated memory of a buffer which was created with clCreateBuffer to zero. I mean without copying a host memory block with zeros to device memory. Is there an api-function or something - i haven't found any (i mean like cudaMemSet in CUDA)

  2. #2

    Re: how to set a buffer's memory to 0

    I did this by writing a kernel that simply writes a given value to the buffer. Something like.

    Code :
    __kernel void setMem(__global float *buffer, float value, uint numFloats)
    {
       if(get_global_id(0) < numFloats)
           buffer[get_global_id(0)] = value;
    }

    Not sure if this is the best way though.

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    5

    Re: how to set a buffer's memory to 0

    would be a workaround - i will try this - thx

Similar Threads

  1. memory buffer question
    By t.verstraete in forum OpenCL
    Replies: 7
    Last Post: 03-21-2012, 06:43 PM
  2. Replies: 3
    Last Post: 01-22-2012, 06:29 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
  •