Skip to content

Incorrect intent on Fortran 08 interfaces to MPI_All* routines #5442

@PhilippOtte

Description

@PhilippOtte

The intent of the receive buffer is declared incorrectly as intent(in) in all MPI_All* routines in the mpi-f08 module on the master branch of version 3.1. According to version 3.1 of the MPI standard (appendix A.3.3), the intent of the receive buffers should be intent(inout) (default). Note that the intent of the receive buffer in MPI_Recv is set according to the standard.

If the receive buffer is of intent(in), the compiler is free to optimize the routine in illegal ways.
For example, the compiler is allowed to interchange the following two calls:

call MPI_Alltoall(sndbuf,100,MPI_INT,recvbuf,100,MPI_INT,MPI_COMM_WORLD)
call MPI_Allreduce(sndbuf,recvbuf,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD)

into:

call MPI_Allreduce(sndbuf,recvbuf,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD)
call MPI_Alltoall(sndbuf,100,MPI_INT,recvbuf,100,MPI_INT,MPI_COMM_WORLD)

The problem could easily be fixed by setting the intent of recvbuf in all MPI_All* routines to intent(inout).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions