Sorry to disturb, but recently I want to try multi-GPU FFT on two 1080GPU cards.
Before, I have tried the sample program named simpleCUFFT_2d_MGPU.cu.
Now I want to do myself problem that is a 3D R2C FFT, and I have read the CUFFT LIBRARY USER’S GUIDE many times, but can not run the program.
The code is there :
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <cuda_runtime.h>
#include <cufftXt.h>
#define N 512
#define NSUM N*N*N
#define NSUM2 N*N*(N/2+1)
int main(int argc, char **argv)
{
int GPU_N;
cudaGetDeviceCount(&GPU_N);
int nGPUs = 2;
int *whichGPUs;
whichGPUs = (int*) malloc(sizeof(int) * nGPUs);
cufftReal *f = (cufftReal*) malloc(sizeof(cufftReal) * NSUM);
cufftComplex *h_d_out = (cufftComplex *) malloc(sizeof(cufftComplex) * NSUM2);
for (int i = 0; i < NSUM; i++) {
f[i] = i % 5000 ;
}
cufftResult result;
cufftHandle planComplex;
size_t* worksize;
cudaLibXtDesc *d_f , *d_out;
worksize = (size_t*) malloc(sizeof(size_t) * nGPUs);
result = cufftCreate(&planComplex);
result = cufftXtSetGPUs(planComplex, nGPUs, whichGPUs);
result = cufftMakePlan3d(planComplex, N, N, N, CUFFT_R2C, worksize);
printf("check 1 : %d \n",result);
result = cufftXtMalloc(planComplex, (cudaLibXtDesc **) &d_f, CUFFT_XT_FORMAT_INPUT);
result = cufftXtMalloc(planComplex, (cudaLibXtDesc **) &d_out, CUFFT_XT_FORMAT_OUTPUT);
printf("check 2 : %d \n",result);
result = cufftXtMemcpy(planComplex, d_f, f, CUFFT_COPY_HOST_TO_DEVICE);
printf("check 3 : %d \n",result);
result = cufftXtExecDescriptorR2C(planComplex, d_f, d_out);
printf("check 4 : %d \n",result);
result = cufftXtMemcpy(planComplex, h_d_out, d_out, CUFFT_COPY_DEVICE_TO_HOST);
printf("check 5 : %d \n",result);
result = cufftXtFree(d_f);
result = cufftDestroy(planComplex);
free(h_d_out);
free(worksize);
return 0;
}
The print info about the result is :
check 1 : 0
check 2 : 0
check 3 : 5
check 4 : 5
check 5 : 5
I find the error code means : Driver or internal cuFFT library error
And I also can not find the detail info about the Parameter of cufftXtSubFormat.
Can anyone give detail information about the four types of format :
CUFFT_XT_FORMAT_INPUT
CUFFT_XT_FORMAT_OUTPUT
CUFFT_XT_FORMAT_INPLACE
CUFFT_XT_FORMAT_INPLACE_SHUFFLED