cufft R2C results only in one quadrant

Hello everyone,

I am working in radio astronomy and I am one of the developers of the gpuvmem software https://github.com/miguelcarcamov/gpuvmem which reconstructs an image from a set of irregular spaced visibilities.

The algorithm uses interpolation to get the value of a (u,v) position in a regular grid (FFT)… This program has been accelerated using CUDA, and also cuFFT C2C.

I have realized that using hermitian symmetry is possible to have the irregular positions in a half of the regular uv-plane. So I am trying to change my program to use cuFFT R2C which also uses less memory.

My new code compiles and runs. However, I realized that there are results just in bottom part of the cuFFT.

For example if the image has 512x512 pixels and is a gaussian with the following values:

I get this as result:

I am using this codes to initialize my plan:

if ((cufftPlan2d(&plan1GPU, (N/2)+1, M, CUFFT_R2C))!= CUFFT_SUCCESS) {
			printf("cufft plan error\n");
			return -1;
}

Where in this case N=512 and M=512

and to run the cuFFT 2D the code is:

if ((cufftExecR2C(plan1GPU, (cufftReal*)device_image, device_V)) != CUFFT_SUCCESS) {
          		printf("CUFFT exec error\n");
          		goToError();
          	}

where device_image is a float pointer of size MxN casted to cufftReal and device_V is a cufftComplex array to store the Fourier transform of size ((N/2)+1) * M.

Any thoughts of why there are only results in the bottom quadrant of device_V?

Regards

This may be of interest:

https://devtalk.nvidia.com/default/topic/826819/2d-cufft-wrong-result/