cufftPlanMany How to use it?

I have difficulty getting this to work.

Is this the proper way to invoke

cufftPlanMany(&plan, 2, { 128, 256 }, NULL, 1, 0, NULL, 1, 0, CUFFT_Z2Z, 1000);

this gives an error :

error: expected an expression

Where is an expression needed?

the third argument calls for a plan of rank 2 with sizes 128X256 !

int dims[2] = {128, 256};
cufftPlanMany(…, dims, …);
Apart from that its ok.

Thank you, this was far from clear to me.

How do you print the error string with cufft?

In normal cuda I can do cudaGetErrorString () but not for cufft.

If I have
cufftResult res;

res = cufftPlanMany(…)
printf ( " res %d \n’,res) // I have the error number

I want the error string, what do I need to do?

Then the manual is wrong at page 22.

Just compare the return value to the ones specified in the CUFFT library documentation and you know the vague reason for the error.

For the error string , this is what I did:

static  char *mkString[9]=

{

		"CUFFT_SUCCESS",

		"CUFFT_INVALID_PLAN",

		"CUFFT_ALLOC_FAILED",

		"CUFFT_INVALID_TYPE",

		"CUFFT_INVALID_VALUE",

		"CUFFT_INTERNAL_ERROR",

		"CUFFT_EXEC_FAILED",

		"CUFFT_SETUP_FAILED",

		"CUFFT_INVALID_SIZE"

};

Didnt look at the example but yes you r right they made a mistake there. They even passed the plan by value instead by reference and omitted the 2nd parameter giving the rank.

Now that I solved that part and cufftPLanMany is working, I cannot get cufftExecZ2Z to run successfully except when the BATCH number is 1. This is far from the 27000 batch number I need. I get a ULF if BATCH > 1.
Is there a trick to get it to run?

Edit : The rank could be wrong here… I will check that first .

Edit :Rank is ok, batch # is wrong, 1 is ok.

You can also do sth like this:

cufftHandle plan;

int rank[2] = {64, 129};

cufftResult rvCufft;

rvCufft = cufftPlanMany(&plan,2,rank,NULL,1,0,NULL,1,0,CUFFT_C2C,32);

checkCufftRv(rvCufft);

...

void checkCufftRv(cufftResult rvCufft)

{

	if(CUFFT_SUCCESS == rvCufft)

			cout << "k" << endl;

	else if...

}

Halle-fuc…in-lujah ^^

Correct me if Im wrong but for a batch size of 27000 and a size of 128x256 per transform you would need 128 * 256 * 27000 * 4 bytes. This sums to a total of a bit more than 3 gigs stored in one array. You have a C2070 for this?

Ok,
I got this part working but I found another problem.
The function cufftExecZ2Z does not give the same answer as the equivalent FFTW3 function.
For the exactly same input array, the first few output elements are shifted by 2 positions and after around 50 elements, the signs seems to be reverse at least for the real part.
This is for a Plan3d (30,30,30) transform.
Was this function ever check against FFTW3 ?
I can show some plots if required.

Edit 1 : Because the plan and the exec are done is the same call and in-place transform is required, I was not aware that the transform was done twice each time I called the function. All seems fine now.

Ok,
I got this part working but I found another problem.
The function cufftExecZ2Z does not give the same answer as the equivalent FFTW3 function.
For the exactly same input array, the first few output elements are shifted by 2 positions and after around 50 elements, the signs seems to be reverse at least for the real part.
This is for a Plan3d (30,30,30) transform.
Was this function ever check against FFTW3 ?
I can show some plots if required.

Edit 1 : Because the plan and the exec are done is the same call and in-place transform is required, I was not aware that the transform was done twice each time I called the function. All seems fine now.

When is the future for this function?

I would like to replace NULL,1 ,0 ,NULL, 1,0 with their FFTW3 equivalent. I will look if I can make all the data contiguous in the mean time.

EDIT:I would like to confirm something.

If I have an array 2X2X2 defined in fortran and I linearize the array to be 1D , then it should not matter when I use cufftPlan if the input array is defined in C or fortran ,right?

But, given that cufftPlanMany does not have stride implemented, if I modify the 1D input array to represent the ‘strided’ array , should I take into account that this array is defined in fortran and modify the sequence before getting it to cufftPlanMany?

This is how I see it in fortran:

array	1D   1 2 3 4 5 6 7 8  Fortran

stride(2)	 1 3 5 7 2 4 6 8  A

stride(2)	 1 3 2 4 5 7 6 8  B

Is B the proper way to assign stride of 2?

Then I would need to convert the 1D array to represent storage in C and then apply the stride.

Does this make any sense?

When is the future for this function?

I would like to replace NULL,1 ,0 ,NULL, 1,0 with their FFTW3 equivalent. I will look if I can make all the data contiguous in the mean time.

EDIT:I would like to confirm something.

If I have an array 2X2X2 defined in fortran and I linearize the array to be 1D , then it should not matter when I use cufftPlan if the input array is defined in C or fortran ,right?

But, given that cufftPlanMany does not have stride implemented, if I modify the 1D input array to represent the ‘strided’ array , should I take into account that this array is defined in fortran and modify the sequence before getting it to cufftPlanMany?

This is how I see it in fortran:

array	1D   1 2 3 4 5 6 7 8  Fortran

stride(2)	 1 3 5 7 2 4 6 8  A

stride(2)	 1 3 2 4 5 7 6 8  B

Is B the proper way to assign stride of 2?

Then I would need to convert the 1D array to represent storage in C and then apply the stride.

Does this make any sense?

@jam1: Thanks for highlighting the error in page 22 of cuFFTmanual 3.1

I was trying to see why the error in expression.

@jam1: Thanks for highlighting the error in page 22 of cuFFTmanual 3.1

I was trying to see why the error in expression.

Is there a limit on the array sizes for this function?

It seems that it gives error if the array is ( > 65536,1,1)

Is there a limit on the array sizes for this function?

It seems that it gives error if the array is ( > 65536,1,1)

Sorry to dig up this old post but it seemed relevant.

I am using cufftplanmany and i run into an error when i try to do > 64 2d transforms for 512x512 single arrays. What is the limit?