cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: FFTW 3.3.5: FFTW Execution in Fortran cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127:
cannam@127:

cannam@127: Next: , Previous: , Up: Calling FFTW from Legacy Fortran   [Contents][Index]

cannam@127:
cannam@127:
cannam@127: cannam@127:

8.3 FFTW Execution in Fortran

cannam@127: cannam@127:

In C, in order to use a plan, one normally calls fftw_execute, cannam@127: which executes the plan to perform the transform on the input/output cannam@127: arrays passed when the plan was created (see Using Plans). The cannam@127: corresponding subroutine call in legacy Fortran is: cannam@127:

cannam@127:
        call dfftw_execute(plan)
cannam@127: 
cannam@127: cannam@127: cannam@127:

However, we have had reports that this causes problems with some cannam@127: recent optimizing Fortran compilers. The problem is, because the cannam@127: input/output arrays are not passed as explicit arguments to cannam@127: dfftw_execute, the semantics of Fortran (unlike C) allow the cannam@127: compiler to assume that the input/output arrays are not changed by cannam@127: dfftw_execute. As a consequence, certain compilers end up cannam@127: optimizing out or repositioning the call to dfftw_execute, cannam@127: assuming incorrectly that it does nothing. cannam@127:

cannam@127:

There are various workarounds to this, but the safest and simplest cannam@127: thing is to not use dfftw_execute in Fortran. Instead, use the cannam@127: functions described in New-array Execute Functions, which take cannam@127: the input/output arrays as explicit arguments. For example, if the cannam@127: plan is for a complex-data DFT and was created for the arrays cannam@127: in and out, you would do: cannam@127:

cannam@127:
        call dfftw_execute_dft(plan, in, out)
cannam@127: 
cannam@127: cannam@127: cannam@127:

There are a few things to be careful of, however: cannam@127:

cannam@127: cannam@127: cannam@127:
cannam@127:
cannam@127:

cannam@127: Next: , Previous: , Up: Calling FFTW from Legacy Fortran   [Contents][Index]

cannam@127:
cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: