Skip to content

mpi_f08: MPI_Wait modifies MPI_ERROR field of status #13205

@gcorbin

Description

@gcorbin

Background information

What version of Open MPI are you using? (e.g., v4.1.6, v5.0.1, git branch name and hash, etc.)

v5.0.5

Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)

From Easybuild

Please describe the system on which you are running

Observed on multiple systems, e.g.

  • Operating system/version: uname -r: 5.14.0-503.26.1.el9_5.x86_64
  • Computer hardware: Single node of Jureca-DC
  • Compiler: GCC 13.3.0 (same issue with NVHPC 24.9)

Details of the problem

MPI_Wait called via use mpi_f08 modifies status%MPI_ERROR.

In this example, status_received%MPI_ERROR is initialized to MPI_SUCCESS, and it should not be modified by MPI_Wait.
But after the MPI_Wait, it is some random value:

program send_irecv_wait

use :: mpi_f08

implicit none

integer :: wrank, wsize
integer :: errs, ierr

integer, parameter :: nelem = 20
integer :: buffer(nelem)
integer, parameter :: tag = 99

type(MPI_Status) :: status_received
type(MPI_Request) :: request

call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, wrank, ierr)
call MPI_Comm_size(MPI_COMM_WORLD, wsize, ierr)

if ( wsize .lt. 2 ) then
    print *, "At least 2 MPI processes are needed for this test"
    call MPI_Abort(MPI_COMM_WORLD, 1, ierr)
end if

if ( wrank .eq. 0 ) then
    buffer = 0
    status_received%MPI_ERROR = MPI_SUCCESS
    call MPI_Irecv(buffer, nelem, MPI_INTEGER, 1, tag, MPI_COMM_WORLD, request, ierr)
    call MPI_Wait(request, status_received, ierr)
    if ( status_received%MPI_ERROR .ne. MPI_SUCCESS ) then
        print '("Wrong value of MPI_ERROR: ", i0)', status_received%MPI_ERROR
    end if
else if ( wrank .eq. 1 ) then
    buffer = 1
    call MPI_Send(buffer, nelem, MPI_INTEGER, 0, tag, MPI_COMM_WORLD, ierr)
end if

call MPI_Finalize(ierr)
end program

However, the program reports

Wrong value of MPI_ERROR: 381821048

(or some other random value)

I am aware of the related issue #12049, but this is different: The error field is initialized and should not be modified.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions