I want to use the cudaMemset function to initialize an image with zeros. The single pixel values are stored as chars (only gray-scale). Of course the image has a specific width and hight. For example if I have an image of 800x600 than I allocate memory and afterwards I use cudaMemset(d_ptr_image, 0, width * hight * sizeof(char)) to set all pixel values to zero… this works perfectly.
Another example: Now I have an image of 802x602. I do the same as above but now the last 1198 pixels are not set to zero. For 804x604 images it works again. I think that this has something to do with the global memory structure, because if width and height are an multiplier of four there are no problems. Maybe CUDA will combine four chars into one float or something like that.
My question is if this problem is known by NVIDIA and if i am right. Would be nice if someone knows a work-around.
And this is really a bug in the CUDA API if there will be a fix in the next version.
I’m looking forward to receiving replies.