Community
cancel
Showing results for 
Search instead for 
Did you mean: 
sternbg
Beginner
87 Views

FFTW2 MPI Fortran interface Fixes

Hello,

One of my users noticed that the FFTW interface routines for MPI in interfaces/fftw2x_cdft were partially incorrect and were missing some F77 interface functions for Complex transforms, viz.:

$ nm /opt/intel/mkl/10.2.4.032/lib/em64t/libfftw2x_cdft_DOUBLE.a | awk '/_f77_/ {print $NF}'
rfftw2d_f77_mpi_create_plan
rfftw3d_f77_mpi_create_plan
rfftwnd_f77_mpi_create_plan
rfftwnd_f77_mpi_destroy_plan
rfftwnd_f77_mpi
rfftwnd_f77_mpi_local_sizes

I was able to code up and test the specific missing functions, and also supply some additional ones missing:

$ nm /opt/intel/mkl/10.2.5.035/lib/em64t/libfftw2x_cdft_DOUBLE.a | awk '/_f77_/ {print $NF}'
fftw_f77_mpi_create_plan_
fftw_f77_mpi_destroy_plan_
fftw_f77_mpi_
fftw_f77_mpi_local_sizes_
fftw2d_f77_mpi_create_plan_
fftw3d_f77_mpi_create_plan_
fftwnd_f77_mpi_create_plan_
fftwnd_f77_mpi_destroy_plan_
fftwnd_f77_mpi_
fftwnd_f77_mpi_local_sizes_
rfftw2d_f77_mpi_create_plan_
rfftw3d_f77_mpi_create_plan_
rfftwnd_f77_mpi_create_plan_
rfftwnd_f77_mpi_destroy_plan_
rfftwnd_f77_mpi_
rfftwnd_f77_mpi_local_sizes_

Notes:

  • The original issue for us was missing F77 functions in nd_create_plan.c
  • I am not sure on scope and portability of MKL_INT vs. int in function args.
  • I did not attempt to account for Fortran name mangling and simply defined *_f77_* with a trailing underscore.
  • There were two bugs in the wrappers as provided with the MKL:
    1. The array index order for 2d and higher transforms must be reversed for F77 functions to account for array storage order in Fortran. This is implemented likewise in the FFTW native code, e.g. at gnu-darwin.org
    2. In rfftwnd_f77_mpi_create_plan(), i.e., for DFTI_REAL, which I used as template for fftwnd_f77_mpi_create_plan(), i.e., for DFTI_COMPLEX, the communicator was hardcoded and passed as MKL_Comm_c2f(MPI_COMM_WORLD). It should be (and now is) MKL_Comm_f2c(*comm) instead.

I submitted a patch at Intel Premier support and Chao there suggested I post here. I'd be happy to do so, if I am permitted. The original files carry Intel's copyright and restrictions on posting ...

Regards, Michael

0 Kudos
1 Reply
Vladimir_Petrov__Int
New Contributor III
87 Views

Michael,

Thank you for this valuable input!

We will add the F77 entries for complex-valued transforms in one of our future releases (OoOFR).

MKL_INT is used in the interface to make it possible to pass 64-bit integer values - this is an extension of the original FFTW interface.

The order and MPI_COMM_WORLD issues will be addressed in OoOFR.

Once again, thank you for your constructive feedback.

Best regards,
-Vladimir
Reply