Casting in Cuda kernel?

Hello all,

I’m trying to do some image processing using Cuda. I’ve read the articles regarding convolution in Cuda and am following most of the strategies. However, My images are not 4-bytes per pixel (like all the examples I’m seeing) but instead 8-bit per pixel grayscales. This seems like it should be beneficial as it will allow a greater number of pixels into each block’s shared memory. My strategy then is to copy the 8-bit pixels into shared memory and then cast them as floats as they are accessed and operated upon in the kernel. Is this okay, or is there a problem doing casts in Cuda? Thanks in advance.


nope, no problem with casting.

Thank you. Lastly, any problem using data type “unsigned char” in my device code?

no, it should work fine.