The code piece below is from X10 samples. For this case, how can I specify the number of threads to run it?
public static def run(a:Array[int](1), b: Rail[int]!) { finish foreach((i) in a.region) { Console.OUT.println(here.id); val bin = a(i)% b.length; atomic b(bin)++; } Regards, Xing ----- Original Message ----- From: "Vijay Saraswat" <vi...@saraswat.org> To: "Mailing list for users of the X10 programming language" <x10-users@lists.sourceforge.net> Sent: Friday, April 9, 2010 7:31:18 AM GMT -05:00 US/Canada Eastern Subject: Re: [X10-users] The use of "!" Liu, Xing wrote: > Hi, > > > Is there anyone could tell me the meaning of "!" in the code below? thanks > > public static def run(a:Array[int](1)!, b: Rail[int]!) { > ... > } > Yes, ! is a place clause. Specifically, this declaration should be read as saying: run requires an argument a, which must be an Array of int of rank 1 that is local (i.e. a.home==here), and b must be a Rail of int that is local (b.home==here). Said differently, the type T! is the type T {self.home==this.home} in case T does not occur in exectuable code (e.g. is the type in a field declaration, or occurs in an implements clause) and the type T{self.home==here} otherwise, i.e. in case T occurs in the declaration or body of methods or constructors, or in the body of initializers. If you declared the method as public static def run(a:Array[int](1), b: Rail[int]) { ... } then a and b are not required to be local. In such a case you cannot invoke methods on a and b that are not marked global. Note that in X10 only methods not marked global are permitted to change the mutable state of the object. Therefore the place type permits you to tell the compiler that the object involved was created in the current place, and hence it is ok to invoke methods on it that are not marked global. Best, Vijay ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users