Calling Wrappers from Fortran

Intel MKL also provides Fortran 77 interfaces of the FFTW3 wrappers. The Fortran wrappers are available for all FFTW3 interface functions and are based on C interface of the FFTW3 wrappers. Therefore they have the same functionality and restrictions as the corresponding C interface wrappers.

The Fortran wrappers use the default INTEGER type for integer arguments. The default INTEGER is 32-bit in Intel MKL LP64 interfaces and 64-bit in ILP64 interfaces. Argument plan in a Fortran application must have type INTEGER*8.

The wrappers that are double-precision subroutines have prefix dfftw_, single-precision subroutines have prefix sfftw_ and provide an equivalent functionality. Long double subroutines (with prefix lfftw_) are not provided.

The Fortran FFTW3 wrappers use the default Intel® Fortran compiler convention for name decoration. If your compiler uses a different convention, or if you are using compiler options affecting the name decoration (such as /Qlowercase), you may need to compile the wrappers from sources, as described in section Building Your Own Wrapper Library.

For interoperability with C, the declaration of the Fortran FFTW3 interface is provided in header file include/fftw/fftw3_mkl_f77.h.

You can call Fortran wrappers from a FORTRAN 77 or Fortran 90 application, although Intel MKL does not provide a Fortran 90 module for the wrappers. For a detailed description of the FFTW Fortran interface, refer to FFTW3 documentation (www.fftw.org).

The following example illustrates calling the FFTW3 wrappers from Fortran:

INTEGER*8 plan
INTEGER N
INCLUDE 'fftw3.f'
COMPLEX*16 IN(*), OUT(*)
!...initialize array IN
CALL DFFTW_PLAN_DFT_1D(PLAN, N, IN, OUT, -1, FFTW_ESTIMATE)
IF (PLAN .EQ. 0) STOP
CALL DFFTW_EXECUTE
!...result is in array OUT 
For more complete information about compiler optimizations, see our Optimization Notice.