(j3.2006) MPI usage problems in Fortran

Craig Rasmussen crasmussen
Tue Mar 18 14:27:57 EDT 2008


OK, thanks.  Back to my original question then.  Is the target  
attribute on the dummy argument sufficient to keep the compiler from  
doing bad things, like deallocating the array immediately after the  
MPI_Isend call?

Regards,
Craig

On Mar 18, 2008, at 12:14 PM, Bill Long wrote:

> If a dummy has TARGET, the actual is not required to have TARGET.   
> See,
> for example, [270:20-22] in f03.
>
> Cheers,
> Bill
>
>
> Craig Rasmussen wrote:
>> 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
>>
>>
>>
>> _______________________________________________
>> J3 mailing list
>> J3 at j3-fortran.org
>> http://j3-fortran.org/mailman/listinfo/j3
>>
>
> -- 
> Bill Long                                   longb at cray.com
> Fortran Technical Support    &              voice: 651-605-9024
> Bioinformatics Software Development         fax:   651-605-9142
> Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120
>
>
>
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3




More information about the J3 mailing list