(j3.2006) [ukfortran] (SC22WG5.5059) WG5 vote on draft TS on further coarray features
Bill Long
longb
Mon Aug 5 10:36:36 EDT 2013
On 8/5/13 8:16 AM, N.M. Maclaren wrote:
> On Aug 5 2013, Bill Long wrote:
>>> Nick Maclaren writes:
>>>>
>>>> > Passim. The specification is messy and restrictive, and should be
>>>> > changed. For example, it is not possible to reduce INTENT(IN) >
>>>> examples.
>>
>> The INTENT(IN) case seems too trivial to justify changing a spec that
>> is increasingly in production use. If you want
>>
>> co_sum( <expr>, X)
>>
>> just write
>>
>> X = <expr>
>> co_sum(X)
>>
>> instead. The second form avoids the compiler having to create a temp
>> for <expr>, which you would want to avoid anyway if X is an array.
>
> Er, no, it doesn't. You have just created a named temporary: X.
Huih? X is the RESULT argument in the first example. It is where the
user wants the answer. It has to be an already existing variable, not a
temp.
> Indeed, one of the main reasons to want a proper two-argument form
> IS to avoid an unnecessary array copy and the consequent inefficient
> use of space.
Quite the opposite. The one-argument form uses less space. The
two-argument form requires double the space. The two-argument form,
indeed, involves a copy from SOURCE to RESULT as part of the operation,
since we are not changing the value of SOURCE.
>
> Consider a large number of images and reducing onto a single result
> image. You are now forcing all of the other images to copy the input
> argument.
If SOURCE is INTENT(IN) such a copy is required anyway. If SOURCE is
left INTENT(INOUT) then the copy can be avoided. The time for the copy
is independent of the number of images, so it is not that material.
Making a new temp is potentially the more problematic action.
Cheers,
Bill
>
> Regards,
> Nick Maclaren.
>
>
>
>
>
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list