(j3.2006) MPI usage problems in Fortran

Craig Rasmussen crasmussen
Tue Mar 18 13:47:35 EDT 2008


A problem was described to me at the MPI Forum meeting last week.   
Using split-phase communication (asynchronous) the user can call send  
on a buffer, do computation, then call wait before reusing the  
buffer.  The sequence is:


       A = 3
       call MPI_Isend(A, ...., request, ...)
       ! do computation not involving A
       call MPI_Wait(request, ...)

The problem is that the way the interfaces are currently defined, the  
compiler can't know that MPI_Isend has retained a pointer to A that  
it doesn't release until after the MPI_Wait call.  So a common hack  
is to add

       call MPI_Get_address(A, ...)

after the MPI_Wait.  I assume the correct way to fix this is to add  
the target attribute to the first dummy argument in MPI_Isend.  Is  
there a better way?  This is especially a problem for codes using the  
implicit MPI interfaces.

However, when I try the following:

       implicit none
       interface
         subroutine send(A)
           real, target :: A(*)
         end subroutine send
       end interface

       real :: buf(10)

       call send(buf)

       end program

I get no error message.  Is this a legal program?  Shouldn't the  
target attribute be required for the actual argument?  Section 5.3.17  
doesn't say.

Thanks,
Craig






More information about the J3 mailing list