Line data Source code
1 : MODULE m_fft_interface 2 : USE m_juDFT 3 : 4 : IMPLICIT NONE 5 : 6 : CONTAINS 7 : 8 116208 : subroutine fft_interface(dimen, length, dat, forw, indices) 9 : use m_types_fft 10 : #ifdef _OPENACC 11 : use openacc 12 : #endif 13 : implicit none 14 : ! provides interfaces to fft subroutines 15 : 16 : integer, intent(in) :: dimen !dimension of fft transformation 17 : integer, intent(in) :: length(dimen) !length of data in each direction 18 : complex, intent(inout) :: dat(:) !data to be transformed, size(dat) should be product(length) 19 : logical, intent(in) :: forw !.true. for the forward transformation, .false. for the backward one 20 : INTEGER, OPTIONAL, INTENT(IN) :: indices(:) !array of indices of relevant/nonzero elements in the FFT mesh 21 : 22 : integer :: size_dat 23 : logical :: l_gpu 24 464832 : type(t_fft) :: fft 25 116208 : call timestart("FFT_interface") 26 464832 : size_dat = product(length) 27 116208 : if (size(dat) .ne. size_dat) call juDFT_error('array bounds are inconsistent', calledby='fft_interface') 28 116208 : if (dimen .ne. 3) call juDFT_error('sorry, not implemented yet for this value of dimen', calledby='fft_interface') 29 : 30 : #ifdef _OPENACC 31 : l_gpu=acc_is_present(dat) 32 : #else 33 116208 : l_gpu=.false. 34 : #endif 35 : 36 116208 : call fft%init(length, forw, indices,l_gpu=l_gpu) 37 116208 : call fft%exec(dat) 38 116208 : call fft%free() 39 : 40 116208 : call timestop("FFT_interface") 41 116208 : end subroutine fft_interface 42 : 43 : 44 : 45 : END MODULE m_fft_interface