Hello everyone.
I use fortran (Intel Fortran Compiler) for my scientific computations and recently I have started using CUDA in order to speed them up. I don’t have any problems with cublas, but in order to feed gemm with data I need to perform some fourier transforms. The next logical step is to calculate all the fourier transforms on GPU. Unfortunately there are no fortran wrappers for cufft provided with CUDA Toolkit. I have tried to write something similar to cublas fortran wrappers, but I failed, since I have very little knowledge of “C”.
So, first I have a question about cublas memory allocation and copying data functions (cublas_alloc, cublas_(s/g)et_vector). Would it be possible to use them in order to feed data to cufft functions? (I think it would not constitute a problem, but I’d like to hear confirmation from somebody more experienced).
Also, maybe someone already tried to write wrappers of this kind and can share? What I only need is cufft_plan1d, cufft_destroy and cufftExecZ2Z. For simplicity I would like to use it altogether with cublas fortran wrappers.
As I said I have tried to do this on my own, but to be honest I don’t know how to handle “plan” (cufftHandle type). In the code below I have left out almost all parts concerning plan (not to leave blanks I’ve put “cufftHandle_plan” in those places), since everything I’ve tried was obviously wrong and ended in sigsegv.
(fortran.c)
int CUFFT_EXECZ2Z (_cufftHandle_plan_, const devptr_t *idata, devptr_t *odata,const int *direction)
{
cuComplex *i = (cuComplex *)(*idata);
cuComplex *o = (cuComplex *)(*odata);
return (int)cufftExecZ2Z(_cufftHandle_plan_, i,o,*direction);
}
int CUFFT_PLAN1D (_cufftHandle_plan_, const int *nx, const int *type, const int *count)
{
return (int) cufftPlan1d(_cufftHandle_plan_, *nx, *type, *count);
}
int CUFFT_DESTROY (unsigned int *plan)
{
return (int) cufftDestroy (plan);
}
(fortran.h)
int CUFFT_PLAN1D (unsigned *plan, const int *nx, const int *type, const int *count);
int CUFFT_DESTROY (const unsigned int *plan);
int CUFFT_EXECZ2Z (const unsigned int *plan, const devptr_t *idata, devptr_t *odata,const int *direction);
I would be grateful for any help, but please take into account in your explanations that I’m not that much familiar with “C”.