Back to Pedalboard

Calling FFTW from Modern Fortran (FFTW 3.3.10)

vendors/fftw3/doc/html/Calling-FFTW-from-Modern-Fortran.html

0.9.221.8 KB
Original Source

Next: Calling FFTW from Legacy Fortran, Previous: Distributed-memory FFTW with MPI, Up: Top [Contents][Index]


7 Calling FFTW from Modern Fortran

Fortran 2003 standardized ways for Fortran code to call C libraries, and this allows us to support a direct translation of the FFTW C API into Fortran. Compared to the legacy Fortran 77 interface (see Calling FFTW from Legacy Fortran), this direct interface offers many advantages, especially compile-time type-checking and aligned memory allocation. As of this writing, support for these C interoperability features seems widespread, having been implemented in nearly all major Fortran compilers (e.g. GNU, Intel, IBM, Oracle/Solaris, Portland Group, NAG).

This chapter documents that interface. For the most part, since this interface allows Fortran to call the C interface directly, the usage is identical to C translated to Fortran syntax. However, there are a few subtle points such as memory allocation, wisdom, and data types that deserve closer attention.

| • Overview of Fortran interface | | | | • Reversing array dimensions | | | | • FFTW Fortran type reference | | | | • Plan execution in Fortran | | | | • Allocating aligned memory in Fortran | | | | • Accessing the wisdom API from Fortran | | | | • Defining an FFTW module | | |