(j3.2006) MPI usage problems in Fortran
Craig Rasmussen
crasmussen
Wed Mar 19 18:33:51 EDT 2008
On Mar 19, 2008, at 12:20 PM, Bill Long wrote:
>>
>>> 1. VALUE and ASYNCHRONOUS lead to a compile error (is this correct?)
>>>
>> Yes it is correct, but don't ask me why.
>>
>
> Right, it is a constraint violation. And it does make sense. The
> point
> of giving a dummy variable the asynchronous attribute is to make sure
> that the physical memory referenced through it is the same memory
> as is
> associated with the corresponding actual argument. That's because an
> async I/O operation initiated in the subprogram might not finish
> before
> control is transferred back to the caller, and the I/O libraries
> need a
> stable target in memory for the data transfers throughout the I/O
> operation. The VALUE attribute has essentially the opposite
> effect. It,
> at least conceptually, implies that the dummy is associated with a
> memory location local to the subprogram that gets its initial value
> from
> the caller, but from that point on is disassociated from the
> corresponding actual argument. In particular, any changes made to the
> value in the local memory location are thrown away on return.
But in this case the variable type was type(C_PTR). I was passing by
value to get to a C routine (I believe it doesn't work otherwise, but
I should check again). I don't really care about the memory address
of the C_PTR itself, the asynchronous aspect of the operation refers
to the memory referenced by the C_PTR. So I certainly see your
point, it's just that I don't think it should apply in this instance.
Regards,
Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20080319/d381e8f9/attachment.html
More information about the J3
mailing list