(j3.2006) MPI usage problems in Fortran

Bill Long longb
Tue Mar 18 14:50:41 EDT 2008


Actually, sort of the opposite, since "any pointers associated with the 
dummy argument become undefined when execution of the procedure 
completes".  Exactly not what you want.

Why not the ASYNCHRONOUS attribute instead?  If you think of the MPI 
data transfers as "I/O", then this is quite close to what asynchronous 
was designed for.  See Note 12.26 on page 271.

Cheers,
Bill



Craig Rasmussen wrote:
> 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
>>     
>
> _______________________________________________
> 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

            




More information about the J3 mailing list