Re: MPI_STATUS_IGNORE etc.

William Gropp (gropp@kgn.ibm.com)
Mon, 19 May 1997 10:27:25 -0500

Dick has raised the excellent question of MPI_STATUS_IGNORE in Fortran. There
is a solution (I think): Fortran now has optional arguments. This would make
the Fortran bindings like the C++ ones: there is no special "status" value,
just a different interface. For example, for MPI_WAIT, the following
INTERFACE specification works just fine:

interface
subroutine mpi_wait( req, status, ierror )
optional :: status
integer req, ierror
integer status(4)
end subroutine
end interface

The following test program also works

--- start example
subroutine mpi_wait( req, status, ierror )
OPTIONAL:: status
Integer req, status(4), ierror

if (present(status)) then
print *, 'status present'
else
print *, 'no status'
endif
req = 0
ierror = 0
return
end

program main
integer a, ierr
integer status(4)
interface
subroutine mpi_wait( req, status, ierror )
optional :: status
integer req, ierror
integer status(4)
end subroutine
end interface

call mpi_wait( a, status, ierr )
call mpi_wait( a, ierror=ierr )
end

--- end example
Note that if we make ierror optional as well, you can do "call mpi_wait(a)".

I suggest that we eliminate MPI_STATUS_IGNORE and MPI_STATUS_IGNORE from the
Fortran bindings, and make use of the languages "optional" feature. This
works most easily only for the last argument in the argument list (except for
ierror). Note that we could even eliminate MPI_BOTTOM if we forced user to
use the argument keyword approach for this case.

We could even eliminate MPI_STATUS_IGNORE from C by forcing a varargs
binding...

Bill