Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] MPI_Comm_set_errhandler: error in Fortran90 Interfacempi.mod
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2010-05-03 22:32:18


Paul --

Most excellent; thanks for the diagnosis and the reproducer. You are absolutely correct that we have a bug in the F90 interface in MPI_COMM_SET_ERRHANDLER and MPI_WIN_SET_ERRHANDLER. The INTENT for the communicator parameter was mistakenly set to INOUT instead of just IN, meaning that a constant parameter like MPI_COMM_WORLD is prohibited from being passed.

A workaround is to assign MPI_COMM_WORLD to temporary integer variable and use that instead.

The fix for OMPI is very easy, but I need to double check with some fortran experts tomorrow about the ABI implications for libmpif90.so.

On May 3, 2010, at 10:44 AM, Paul Kapinos wrote:

> Hello OpenMPI / Sun/Oracle MPI folks,
>
> we believe that the OpenMPI and SunMPI (Cluster Tools) has an error in
> the Fortran-90 (f90) bindings of the MPI_Comm_set_errhandler routine.
>
> Tested MPI versions: OpenMPI/1.3.3 and Cluster Tools 8.2.1
>
> Consider the attached example. This file uses the "USE MPI" to bind the
> MPI routines f90-style. The f77-style "include 'mpif.h'" is commented out.
>
> If using Intel MPI the attached example is running error-free (with both
> bindings).
>
> If trying to compiler with OpenMPI and using f90 bindings, any compilers
> tested (Intel/11.1, Sun Studio/12.1, gcc/4.1) says the code cannot be
> build because of trying to use a constant (MPI_COMM_WORLD) as input.
>
> For example, the output of the Intel compiler:
> -----------------------------------------------------------------------------
> MPI_Comm_set_errhandler.f90(12): error #6638: An actual argument is an
> expression or constant; this is not valid since the associated dummy
> argument has the explicit INTENT(OUT) or INTENT(INOUT) attribute. [0]
> call MPI_Comm_set_errhandler (MPI_COMM_WORLD, errhandler, ierr) !
> MPI_COMM_WORLD in MPI_Comm_set_errhandler is the problem...
> ------------------------------^
> compilation aborted for MPI_Comm_set_errhandler.f90 (code 1)
> -----------------------------------------------------------------------------
> With the f77 bindings, the attached program compiles and runs fine.
>
> The older (deprecated) routine MPI_Errhandler_set which is defined to
> have the same functionality works fine with both bindings and all MPI's.
>
> So, we believe the OpenMPI implementation of MPI standard erroneously
> sets the INTENT(OUT) or INTENT(INOUT) attribute for the communicator
> attribute. The definition of an error handle for MPI_COMM_WORLD should
> be possible which it is currently not.
>
> Best wishes,
> Paul Kapinos
>
>
>
>
>
> --
> Dipl.-Inform. Paul Kapinos - High Performance Computing,
> RWTH Aachen University, Center for Computing and Communication
> Seffenter Weg 23, D 52074 Aachen (Germany)
> Tel: +49 241/80-24915
>
> PROGRAM sunerr
> USE MPI ! f90: Error on MPI_Comm_set_errhandler if using this with OpenMPI / Sun MPI
> !include 'mpif.h' ! f77: Works fine with all MPI's tested
> IMPLICIT NONE
> !
> integer :: data = 1, errhandler, ierr
> external AbortWithMessage
> !
> call MPI_Init(ierr)
> call MPI_Comm_create_errhandler (AbortWithMessage, errhandler, ierr) ! Creating a handle: no problem
>
> call MPI_Comm_set_errhandler (MPI_COMM_WORLD, errhandler, ierr) ! MPI_COMM_WORLD in MPI_Comm_set_errhandler is the problem... in f90
> !call MPI_Errhandler_set (MPI_COMM_WORLD, errhandler, ierr) ! and this one deprecated function works fine both for f77 and f90
>
>
> ! ... a errornous MPI routine ...
> call MPI_Send (data, 1, MPI_INTEGER, 1, -12, MPI_COMM_WORLD, ierr)
> call MPI_Finalize( ierr )
>
> END PROGRAM sunerr
>
>
>
> subroutine AbortWithMessage (comm, errorcode)
> use mpi
> implicit none
> integer :: comm, errorcode
> character(LEN=MPI_MAX_ERROR_STRING) :: errstr
> integer :: stringlength, ierr
> call MPI_Error_string (errorcode, errstr, stringlength, ierr)
> write (*,*) 'Error: =+=> ', errstr, ' =+=> Aborting'
> call MPI_Abort (comm, errorcode, ierr)
> end subroutine AbortWithMessage
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/