Results 1 to 2 of 2

Thread: Copying memory of zero size

  1. #1
    Junior Member
    Join Date
    Nov 2009

    Copying memory of zero size


    I have a kernel that gets some lightsource arrays as input parameters (directional, point and spot). The number of each light source array could also be 0. If the size is zero, I get an error when allocating mem on the gpu for that array. Since that doesn't work, I tried to pass the kernel NULL as the light source array if the ammount is 0. But then I also get an error from the clSetKernelArg-function. How to avoid that and make the programm run properly?


  2. #2
    Senior Member
    Join Date
    Sep 2002
    Santa Clara

    Re: Copying memory of zero size

    You should be able to pass a NULL value for a kernel argument declared as a __global pointer to a type. Another option would be to pass a count variable as an argument which could be set to 0. The kernel could check this value to see if it is non-zero.

Similar Threads

  1. copying a variable from host memory to device memory
    By shahsaurabh1990 in forum OpenCL
    Replies: 4
    Last Post: 03-26-2013, 01:10 AM
  2. Replies: 5
    Last Post: 10-02-2012, 11:55 AM

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