[MPIWG Fortran] An implementation problem of F08 binding

William Gropp wgropp at illinois.edu
Thu May 1 14:20:11 CDT 2014

The first problem is a quality of Fortran compiler implementation issue - there's no technical reason why the compiler can't tell you that "there is no subprogram MPI_SEND with a real for the second argument", for example. 


William Gropp
Director, Parallel Computing Institute
Thomas M. Siebel Chair in Computer Science
University of Illinois Urbana-Champaign

On May 1, 2014, at 1:34 PM, Junchao Zhang wrote:

> Hello,
>    I met a problem when implementing F08 binding in MPICH.  I have a file mpi_f08.F90, which contains all interfaces
> module mpi_f08
> ..
> interface MPI_Send
>     subroutine MPI_Send_f08ts(buf, count, datatype, dest, tag, comm, ierror)
>         use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
>         implicit none
>         type(*), dimension(..), intent(in) :: buf
>         integer, intent(in) :: count, dest, tag
>         type(MPI_Datatype), intent(in) :: datatype
>         type(MPI_Comm), intent(in) :: comm
>         integer, optional, intent(out) :: ierror
>     end subroutine MPI_Send_f08ts
> end interface MPI_Send
> ..
> end module mpi_f08
> Then for each subroutine, I create a separate file which implement the wrapper function in Fortran.  For example, send_f08ts.F90 has
> subroutine MPI_Send_f08ts(buf, count, datatype, dest, tag, comm, ierror)
>     use :: mpi_f08, only : MPI_Datatype, MPI_Comm
>     use, intrinsic :: iso_c_binding, only : c_int
>     use :: mpi_c_interface, only : c_Datatype, c_Comm
>     use :: mpi_c_interface, only : MPIR_Send_cdesc
>     implicit none
>     ..
> end subroutine MPI_Send_f08ts
> Bill Long pointed out problems of the implementation. 1) When users supply a bad argument to MPI_Send(), the compiler complains "No specific match can be found for the generic subprogram call MPI_SEND", instead of pointing out the offending arg. 2) The wrapper is not in a module, which eliminates many of the advantages of using modern Fortran.
> I met the first problem in my testing. I was wondering if it is possible to fix that, so I ask Fortran expert here for advices. 
> Thank you very much.
> --Junchao Zhang
> _______________________________________________
> mpiwg-fortran mailing list
> mpiwg-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpiwg-fortran/attachments/20140501/b7da9a9d/attachment-0001.html>

More information about the mpiwg-fortran mailing list