Re: RemoteArray and Array.asyncCopy

18 views
Skip to first unread message

Vijay Saraswat

unread,
Dec 10, 2010, 6:51:04 PM12/10/10
to Chatura Atapattu, Martha Kim, Vijay Saraswat, Karthik Kumar Srivatsa, coms49...@googlegroups.com
On 12/10/2010 3:51 PM, Chatura Atapattu wrote:
All asyncCopy methods in the Array class only allow copying data between an Array and RemoteArray.  What specifically makes an array remote?  Must it be stored at a different place?  If that is the case, how exactly do you obtain a reference to an array that is at a remote place?

Thanks,

- Chat
You have to use an x10.lang.GlobalRef for it.

Check it out and let me know if you want more clarifications.

Mohan

unread,
Dec 11, 2010, 2:36:25 PM12/11/10
to coms49...@googlegroups.com
Hello,

val arr = new Array[Int](1);
arr(0) = 0;
val remArr = new RemoteArray(arr);
Console.OUT.println(remArr(0));
val glob = GlobalRef(remArr);
val home = here;
for(p in Place.places()) {
if(p != home)  {
at (p) {
arr(0) = 1;
Console.OUT.println(arr(0));
finish Array.asyncCopy(arr, at(glob.home()) glob.apply());
}
break;
}

}
Console.OUT.println(remArr(0));

Is the syntax above the one you were looking for? I expected the last println to print 1 but it prints 0. Could you please tell me where I went wrong.
--
Mohan
Reply all
Reply to author
Forward
0 new messages