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

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to