12 /*#define GMX_FFT_FFTW3*/
18 #elif defined GMX_THREADS
22 #ifndef _gmx_parallel_3dfft_h_
23 typedef void* MPI_Comm
;
37 #ifdef FFT5D_MPI_TRANSPOSE
38 #include <fftw3-mpi.h>
41 /* TODO: optional wrapper
43 #include <fftw/fftw3.h>
44 #ifdef FFT5D_MPI_TRANSPOSE
45 #include <fftw/fftw3-mpi.h>
51 #ifndef GMX_DOUBLE /*TODO how to not how have to do this GMX specific in here?
52 can't be in gmx_parallel_3dfft.h because it has to be also be set when included from fft5d.c */
57 typedef t_complex fft5d_type
;
59 #define FFTW(x) fftwf_##x
60 typedef float fft5d_rtype
;
61 #define FFT5D_EPS __FLT_EPSILON__
62 #define FFT5D_MPI_RTYPE MPI_FLOAT
64 #define FFTW(x) fftw_##x
65 typedef double fft5d_rtype
;
66 #define FFT5D_EPS __DBL_EPSILON__
67 #define FFT5D_MPI_RTYPE MPI_DOUBLE
71 double fft
,local
,mpi1
,mpi2
;
73 typedef struct fft5d_time_t
*fft5d_time
;
75 typedef enum fft5d_flags_t
{
88 gmx_fft_t p1d
[3]; /*1D plans*/
90 FFTW(plan
) p2d
; /*2D plan: used for 1D decomposition if FFT supports transposed output*/
91 FFTW(plan
) p3d
; /*3D plan: used for 0D decomposition if FFT supports transposed output*/
92 #ifdef FFT5D_MPI_TRANSPOSE
98 int N
[3],M
[3],K
[3]; /*local length in transposed coordinate system (if not divisisable max)*/
99 int pN
[3],pM
[3], pK
[3]; /*local length - not max but length for this processor*/
100 int oM
[3],oK
[3]; /*offset for current processor*/
101 int *iNin
[3],*oNin
[3],*iNout
[3],*oNout
[3]; /*size for each processor (if divisisable=max) for out(=split)
102 and in (=join) and offsets in transposed coordinate system*/
103 int C
[3],rC
[3]; /*global length (of the one global axes) */
104 /* C!=rC for real<->complex. then C=rC/2 but with potential padding*/
105 int P
[2]; /*size of processor grid*/
108 /* int realcomplex;*/
110 /*int N0,N1,M0,M1,K0,K1;*/
116 typedef struct fft5d_plan_t
*fft5d_plan
;
118 void fft5d_execute(fft5d_plan plan
,fft5d_time times
);
119 fft5d_plan
fft5d_plan_3d(int N
, int M
, int K
, MPI_Comm comm
[2], int flags
, fft5d_type
** lin
, fft5d_type
** lin2
);
120 void fft5d_local_size(fft5d_plan plan
,int* N1
,int* M0
,int* K0
,int* K1
,int** coor
);
121 void fft5d_destroy(fft5d_plan plan
);
122 fft5d_plan
fft5d_plan_3d_cart(int N
, int M
, int K
, MPI_Comm comm
, int P0
, int flags
, fft5d_type
** lin
, fft5d_type
** lin2
);
123 void fft5d_compare_data(const fft5d_type
* lin
, const fft5d_type
* in
, fft5d_plan plan
, int bothLocal
, int normarlize
);