Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: FFTW 3.3.5: Plan execution in Fortran Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42:
Chris@42:

Chris@42: Next: , Previous: , Up: Calling FFTW from Modern Fortran   [Contents][Index]

Chris@42:
Chris@42:
Chris@42: Chris@42:

7.4 Plan execution in Fortran

Chris@42: Chris@42:

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

Chris@42:
 call fftw_execute(plan)
Chris@42: 
Chris@42: Chris@42: Chris@42:

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

Chris@42:

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

Chris@42:
 call fftw_execute_dft(plan, in, out)
Chris@42: 
Chris@42: Chris@42: Chris@42:

There are a few things to be careful of, however: Chris@42:

Chris@42: Chris@42: Chris@42:
Chris@42:
Chris@42:

Chris@42: Next: , Previous: , Up: Calling FFTW from Modern Fortran   [Contents][Index]

Chris@42:
Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: