OpenMPI 3 Fortran 2008 interface update

In legacy Fortran MPI programs, near the top of the procedure we would have:

use mpi

or

include 'mpi.h'

Now, it is recommended to use the OpenMPI Fortran 2008 interface

use mpi_f08

Interfacing MPI 3 with legacy Fortran code

You will notice for example that constants like mpi_comm_word and mpi_real are no longer integer data type, but rather custom types.

Many legacy and even current libraries (such as MUMPS 5) have not yet updated to be polymorphic for this enhanced variable type.

Here is a minimal working example for MUMPS using the backwards compatible OpenMPI 3 interface, grabbing the integer via the %mpi_val property.

program mumps_mpi3

use mpi_f08
include 'dmumps_struc.h'  ! per MUMPS 5 manual

type(dmumps_struc) mumps_par

mumps_par%comm = mpi_comm_world%mpi_val   ! %mpi_var emits the legacy integer


end program

Notes

OpenMPI 3

Leave a Comment