CUFFT - errors depend on size of 2-D array? Errors seen in FFT results - depending on the size of th

I am using a simple program to test the CUFFT functionality. Has anyone had experience using CUFFT for images?

Basically generate a 2-D grayscale image (matrix of numbers) calculate the FFT using CUFFT, and then reconstruct the image from the Fourier coefficients using inverse fourier transform.
The Fourier cofficient matrix calculated using the cufftExecR2C() has the same dimensions as the input (image) matrix. cufftExecC2R() is used for reconstructing the original image.

I observed that the output image has no errors for image sizes of 100 x 80, 200 x 160, 400 x 200. I see small errors for image size 800 by 400 and large amount of error if the input image size is 1080 by 720 (which is the size of the images in my target application). Is there a relation, or is it more likely a bug in my code?

Also, I observed that when the size is 400 x 200, there is no error between the original image and the FFT-IFFT reconstructed. If the size is changed to 400x201, there is significant error in the reconstruction. I am not sure why this happens. Should I use zero-padding and make the size equal to the nearest power or 2, or something like that? (I am not sure that is the reason for error because I do get an error for 1024x512 image as well)

The input image in all cases is a white box (intensity value = 1) on a black background (intensity value = 0).

Turns out the errors were due to not normalizing the ifft image before displaying. I cant seem to delete this topic, hence this reply