I was trying to compare the performance of copying a Rail[Byte] between 2 
places using Rail.async and using "at". Each place is running on a different 
host, and the network speed is 1000Mb/s.


The first method:

1. A rail is created

2. A GlobalRef to that rail is created

3. Used At to move to the second place   -> here I expect that "at" will need 
to copy only the GlobalRef, not the whole array.

4. Used Rail.asyncCopy from the second place to copy the array using the 
GlobalRef


The second method:

1. A rail is created

2. Used At to move to the second place   -> here I expect that "at" will 
implicitly copy the whole rail, that is why I expected it to be slower than the 
"at" in the first method.

3. Used Rail.copy from the second place to copy the array


That is the used program code:

import x10.util.Timer;
public class TestRemoteCopy {
    public static def main(args:Rail[String]) {
     //Create Rail and Initialize it
        val size = Long.parse(args(0));
        val source:Rail[Byte] = new Rail[Byte](size);
        val sourcePlace = Place.places()(0);
        val destPlace = Place.places()(1);
        for (var i:Long = 0; i < size; i++){
            source(i) = (i%128) as Byte;
        }

        //Copy using Rail.asyncCopy
        val gr = GlobalRail[Byte](source);
        val timeBeforeAt = Timer.milliTime();
        at (destPlace){
                Console.OUT.println("At 
Time["+(Timer.milliTime()-timeBeforeAt)+"] ...");
         val dest:Rail[Byte] = new Rail[Byte](size);//1<
         val timeBeforeAsyncCopy = Timer.milliTime();
                finish Rail.asyncCopy(gr, 0, dest, 0, size);
                Console.OUT.println("AsyncCopy 
Time["+(Timer.milliTime()-timeBeforeAsyncCopy)+"] ...");
        }

        //Copy using at
        val timeBeforeSecondAt = Timer.milliTime();
        at(destPlace){
         Console.OUT.println("Second At 
Time["+(Timer.milliTime()-timeBeforeSecondAt)+"] ...");
         val dest:Rail[Byte] = new Rail[Byte](size);
         val timeBeforeSecondCopy = Timer.milliTime();
         Rail.copy(source, 0, dest, 0, size);
         Console.OUT.println("Second Copy 
Time["+(Timer.milliTime()-timeBeforeSecondCopy)+"] ...");
        }
    }
}

These are some results, time is printed in milliseconds:

Rail Size: 1024 bytes

Native X10:

At Time[4305] ...
AsyncCopy Time[1] ...
Second At Time[4305] ...
Second Copy Time[0] ...

Managed X10:
At Time[4521] ...
AsyncCopy Time[31] ...
Second At Time[4308] ...
Second Copy Time[1] ...

Rail Size: 1048576 bytes (1024*1024)
Native X10:
At Time[4306] ...
AsyncCopy Time[10] ...
--> using "at" hangs

Managed X10:
At Time[4534] ...
AsyncCopy Time[106] ...
Second At Time[4331] ...
Second Copy Time[0] ...

I have some questions based on these numbers:

1) Why "at" in the first method, which is supposed to copy only a GlobalRef, is 
taking as much time or even more time than the second method which copies the 
whole rail?

2) Is there a maximum limit on the data size that "at" can copy in native X10?

3) The above numbers suggests that using "at" for copying rails is more 
preferable than using Rail.asyncCopy. Is this conclusion correct?


?Best Regards,
Sara
------------------------------------------------------------------------------
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to