Igor Peshansky wrote:
> Vijay Saraswat <vi...@saraswat.org> wrote on 12/16/2009 08:37:40 PM:
>
>   
>> This should be straightforward, at the risk of extra copying. Something 
>> like:
>>
>> static def copyTo[T](A:Array[T], p:Place):Array[T]{self.dist == 
>>     
> A.region->p} {
>
> Shouldn't it be "{self.dist == A.region->here}"?
>   
No, that would be wrong. (The code copies the array at the source into a 
ValRail at the source, copies the valRail to the destination p, creates 
an array at p, and returns a remote ref to the array at p. Any 
subsequent async (p) S will let S access the array at dest locally.)
>   
>>   val ACopy  = ValRail.make(0..A.region.size()-1,
>>                             (i:int) => A(A.region.coord(i)));
>>   at (p)
>>       return Array.make[T](A.region -> p,
>>                            (p:Point) => ACopy(A.region.ord(p)));
>>     
>
> Shouldn't this be "return at (p) Array.make[T](...}"?
>   
That should be ok as well. (The original code should also be ok and 
should give the same behavior.)
>   
>>   }
>> }
>>     
>
> This is more than a risk -- the code will always copy.
> Plus, there's an extra communication round trip, which is, in some
> ways, worse than copying.
>
> So, yes, the naive implementation is straightforward.  But it's not
> clear whether the resulting library would be worth using (in terms of
> performance).
>         Igor
>
>   
I understood Josh's message as follows. There is an array A at place q 
(over a distribution R -> here, for arbitrary R). It is desired to copy 
it over to place p, so that subsequent activities at p can access the 
array A locally at p rather than incurring a round-trip latency (p to q 
to p) for each access. This code accomplishes that and is a clear win.

The copy at place q from A  to the ValRail can be avoided in a native 
implementation
>>> Hi all,
>>>
>>> I have array-structured data that is calculated in one place, which I 
>>> then want to make available to activities running at other places. 
>>>
>>> The obvious way is to make the array the return value of a remote 
>>> expression.  This creates a remote reference to the array, but then 
>>> access to each individual element must also be done by a remote 
>>> expression, which is hardly efficient.  Importantly the array data is 
>>> calculated once and then never updated, so what is required is a final 
>>>       
>
>   
>>> read-only snapshot of the array.
>>>
>>> AFAIK the only array-like class that can be transferred between places 
>>>       
>
>   
>>> is ValRail.  However this does not support arbitrary Regions as do 
>>>       
> arrays.
>   
>>> Is there an elegant way of transferring complete Array-like objects 
>>> between places?
>>>       

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to