Turing : The FFTW library

Description

FFTW is an FFT 1D, 2D and 3D library which is scalable and parallel.

Installed versions

  • FFTW 2.1.5
  • FFTW 3.2.2
  • FFTW 3.3.2
  • FFTW 3.3.3 (default version)

Characteristics

  • Version 2.1.5 is parallelized with MPI; it is also mono-processor and multithreaded.
    Attention : This version is more than 10 years old and is NOT compatible with the other newer installed versions.
  • Version 3.2.2 is not parallelized with MPI; it is only mono-processor and multithreaded.
  • Versions 3.3.2 and 3.3.3 are parallelized with MPI and are also multithreaded (pthreads and OpenMP). Moreover, they include a new Fortran 2003 interface.

Utilisation

The available versions are accessed with the module command. To use the default version:

$ module load fftw
$ mpixlf95_r mon_code_fftw.f90

To compile with a specific version:

$ module load fftw/3.3.3
$ mpixlf95_r mon_code_fftw.f90

Example

fftw_1d_f2003.f90
module FFTW3
  use, intrinsic :: iso_c_binding
  include 'fftw3.f03'
end module FFTW3
 
program fftw_1d
 
  use FFTW3
  implicit none
  integer(kind=C_INT), parameter  :: n = 16
  complex(kind=C_DOUBLE_COMPLEX), dimension(n)  :: in, out
  type(C_PTR) :: p, p2
  integer i,j
  real fact
 
  do i=1,N
     j=i-1
     in(i)=cmplx(j*j,1)
  enddo
 
  write(*,*)"create plans"
 
  p  = fftw_plan_dft_1d(N,in,out,FFTW_FORWARD,FFTW_ESTIMATE)
  p2 = fftw_plan_dft_1d(N,in,out,FFTW_BACKWARD,FFTW_ESTIMATE)
 
  write(*,*)"do it"
 
  call fftw_execute_dft(p, in, out)
  do i=1,N
     write(*,"(f12.4,1x,f12.4)")out(i)
  enddo
 
  write(*,*)
  write(*,*)"undo it"
 
  call fftw_execute_dft(p2, out,in)
  fact=1.0/N
  do i=1,N
     write(*,"(f10.2,1x,f10.2)")in(i)*fact
  enddo
 
  write(*,*)"clean up"
  call fftw_destroy_plan(p)
  call fftw_destroy_plan(p2)
 
end program fftw_1d
$ module load fftw
$ mpixlf90_r fftw_1d_f2003.f90

Comment

The fftw_plan type, appearing in the argument calls of the routines, corresponds to a C address. This type must be explicitly coded in Fortran INTEGER(kind=8) or more rigorously, type(C_PTR), by using the Fortran 2003 interface as in the example above.

Documentation