I'm trying to use MPI_TYPE_MATCH_SIZE (Fortran interface) and no matter what I give it, it always fails with MPI_ERR_ARG.

The last line of code in type_match_size_f.c seems to be the source of the problem, as it always calls the error handler:

(void)OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);

Putting this in the preceding if-else statement seems to work for me, although I'm not sure if that is the appropriate fix, ie:

     if( c_type != &ompi_mpi_datatype_null )
         *ierr = OMPI_INT_2_FINT( MPI_SUCCESS );
     else {
         *ierr = OMPI_INT_2_FINT( MPI_ERR_ARG );
(void)OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
     }

Test code is below - I linked against OpenMPI 1.2.3.

program test_type_match
  use mpi
  implicit none

  integer, parameter :: nval=5
  real, dimension(nval) :: testvals
  integer :: ierr, isize
  integer :: my_type

  call MPI_INIT(ierr)
  call MPI_SIZEOF(testvals,isize,ierr)
  call MPI_TYPE_MATCH_SIZE(MPI_TYPECLASS_REAL, isize, my_type, ierr)
  call MPI_FINALIZE(ierr)

end program test_type_match

Thanks,
Jeff

Reply via email to