Can I call cufft using pgi compiler?
My code is:
#include <stdio.h>
#include <math.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cufft.h>
#define NX 1200
#define NY 1200
int main(int argc, char *argv)
{
cufftHandle plan;
cufftComplex devPtr;
cufftComplex data[NXNY];
int i;
struct timeval t1,t2,t3,t4;
long c_fft,c_all;
/* source data creation /
for(i= 0 ; i < NXNY ; i++){
data_.x = 1.0f;
data.y = 1.0f;
}
gettimeofday(&t1,NULL);
/* GPU memory allocation /
cudaMalloc((void*)&devPtr, sizeof(cufftComplex)NXNY);
/* transfer to GPU memory /
cudaMemcpy(devPtr, data, sizeof(cufftComplex)NXNY, cudaMemcpyHostToDevice);
gettimeofday(&t2,NULL);
/ creates 2D FFT plan /
cufftPlan2d(&plan, NX, NY, CUFFT_C2C);
/ executes FFT processes /
cufftExecC2C(plan, devPtr, devPtr, CUFFT_FORWARD);
/ executes FFT processes (inverse transformation) */
cufftExecC2C(plan, devPtr, devPtr, CUFFT_INVERSE);
gettimeofday(&t3,NULL);
c_fft=(t3.tv_sec-t2.tv_sec)1000000+(t3.tv_usec-t2.tv_usec);
/ transfer results from GPU memory /
cudaMemcpy(data, devPtr, sizeof(cufftComplex)NXNY, cudaMemcpyDeviceToHost);
/ deletes CUFFT plan /
cufftDestroy(plan);
/ frees GPU memory /
cudaFree(devPtr);
gettimeofday(&t4,NULL);
c_all=(t4.tv_sec-t1.tv_sec)1000000+(t4.tv_usec-t1.tv_usec);
printf(“%13ld microseconds for fft\n”,c_fft);
printf(“%13ld microseconds for all\n”,c_all);
/ for(i = 0 ; i < NXNY ; i++){
printf(“data[%d] %f %f\n”, i, data.x, data.y);
}
*/
return 0;
}
I compiled with “pgcc -I /opt/pgi/linux86-64/10.2/cuda/include/ -L /usr/local/cuda/lib/ fft2d.c -lcufft” and got the error message like this:
PGC-F-0249-#error – — !!! UNSUPPORTED COMPILER !!! — (/opt/pgi/linux86-64/10.2/cuda/include/host_defines.h: 41)
PGC/x86-64 Linux 10.2-0: compilation aborted
This code works with “gcc -I /usr/local/cuda/include/ -L /usr/local/cuda/lib/ fft2d.c -lcufft”
Could anyone suggest what I can do to solve fft using the pgi compiler?
Thank you._