Hi there, the output looks fine. You should have 100x "test,Place(0)" and 100x "test,Place(1)". I am getting these messages in mixed order, when compiling with native X10 (x10c++):
[...] test,Place(0) test,Place(0) test,Place(0) test,Place(0) test,Place(0) test,Place(0) test,Place(0) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(1) test,Place(0) test,Place(1) test,Place(1) test,Place(1) [...] When compiling with managed X10 (x10c), i get the same results as you do (first the Place(0)'s, then the Place(1)'s). So it seems to be only a matter of output-ordering. Also, you will not get any speedup by using multiple places in this special scenario since println(...) is the performance-bottleneck. I have modified you program a little bit, so you can measure a speedup: public class Hello { public static def main(args:Rail[String]) { val iter:Long = Long.parse(args(0)); val hello = new Hello(); val start:Long = System.currentTimeMillis(); val each = iter/Place.MAX_PLACES; finish { for (var i:Long = 0; i < Place.MAX_PLACES; ++i) { at (Place(i)) async { hello.test(each); } } } val stop:Long = System.currentTimeMillis(); Console.OUT.println( here + ": time consumed = " + (stop - start) + " ms."); } private def test(val iter:Long) { for(var i:Long=0;i<iter;i++) { //Console.OUT.println("test,"+here); } } } Output with managed X10: One place: $ x10 Hello 10000000000 Place(0): time consumed = 6605 ms. Two places: $ x10 Hello 10000000000 Place(0): time consumed = 3538 ms. Output with native X10: One place: $ ./Hello 10000000000 Place(0): time consumed = 25218 ms. Two places: ./Hello 10000000000 Place(0): time consumed = 13012 ms. (I used Java 1.7.0_60, gcc 4.8.3 and x10 2.4.3) I hope i was able help. =) Cheers, Marco Am 22.08.2014 um 08:54 schrieb 王辰: > Hello everyone, i'm new to x10. > I have a little problem about parallelization, here's my code: > > public class Hello { > > public static def main(args:Rail[String]) { > > val hello = new Hello(); > > at (Place(1)) async hello.test(); > > at (Place(0)) async hello.test(); > > } > > private def test() { > > for(var i:Int=0n;i<100n;i++) { > > Console.OUT.println("test,"+here); > > } > > } > > > I thought the output should not be the same if i run it several time. > But it was always the same: > > Place(0) > Place(0) > ... > Place(0) > Place(0) > Place(1) > Place(1) > ... > Place(1) > Place(1) > > Can anyone tell me is it so and what should i do to implement real > parallelization? > > Thanks. > > > > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > > > > _______________________________________________ > X10-users mailing list > X10-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/x10-users > ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users