cufftExecC2R altering input data after call Input data changes after cufftExecC2R is called for non

Good day,

I’m wondering why cufftExecC2R changes the values in its input array (not that it ever should but it only happens when the dimensions aren’t powers of two.)

The CUFFT 3.1 documentation says “The input array holds only the non‐redundant complex Fourier coefficients” (p.13) and this is what I’ve done, despite the example for C2R allocating M*N complex terms for the input data.

I’ve attached pictures of the values of A in the 64x64 case and the 65x65 case before and after the call.

Any help is greatly appreciated. Thanks.


/* A is my non-redundant-only complex terms… (M_half = M/2+1)

  • B is my real MxN result.

  • I’ve shown the making of the plan, I show the allocation of A (only to show it’s M_half x N)

  • and I show where my values change with respect to the call to cufftExecC2R.


cufftPlan2d(&plan_C2R, N, M, CUFFT_C2R); // Dimensions swapped for column-major

err = cudaMalloc((void**)&A, sizeof(cufftComplex)M_halfN); // A is non-redundant terms only

// A is fine

res = cufftExecC2R(plan_C2R, A, B );

// A is not fine in 65x65 case