Hi Marc, the "No stacktrace" BadPlaceException also caused me trouble and I have raised as http://jira.codehaus.org/browse/XTENLANG-540
Debugging with GDB should allow you to see where the exception is thrown. You will need to compile for debugging and then debug each place as a separate process. There are some instructions at http://docs.codehaus.org/display/XTENLANG/X10+Application+Development (right at the end). In X10 1.7, an object of reference type (any class that inherits from x10.lang.Ref) has a field "location" which is the Place at which the object is located. For distributed arrays, Array.dist(pt: Point) or Array.dist(i0 : Int, i1 : Int, ...) give the Place to which the given Point/index is mapped. For example myArray.dist(1,2) I have also observed the x10c++ warnings, they seem benign but I agree they should probably be cleaned up at some stage. Cheers, Josh TAJCHMAN Marc wrote: > Hi, > > As I'm doing several tests in X10 and many wrong data placement errors ;-), > execution frequently produces output like this : > > 0.err: Uncaught exception at place 0: x10.lang.BadPlaceException: bad place > exception > 0.err: x10.lang.BadPlaceException: bad place exception > 0.err: at No stacktrace recorded. > > Is there a way (compiler option, runtime option, exception catching, other ?) > to have more information about the source line were exception occurs, wrong > access to which variable, call stack trace, etc ? > > Is there a function, macro, ... that can inform where a variable (scalar or > component of an array) is located ? UPC for example, has such a function > (upc_threadof). > > > > Also, the c++ compiler frequently issue the following warnings : > .../include/x10aux/bootstrap.h:104: warning : format ‘%ld’ expects type ‘long > int’, but argument 3 has type ‘x10_int’ > .../include/x10aux/bootstrap.h:113: warning : format ‘%ld’ expects type ‘long > int’, but argument 3 has type ‘x10_int’ > .../include/x10aux/bootstrap.h:126: warning : format ‘%ld’ expects type ‘long > int’, but argument 3 has type ‘x10_int’ > > Normally warnings like these ones are harmless, but one never knows. > > For info : > x10c++ version 1.7.6 > Polyglot compiler toolkit version 3.1.0 (2009-06-11 14:44:14) > (binary version downloaded from the web site) > > gcc/g++ : > Target: i486-linux-gnu > gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) > > Thanks in advance > Marc > > ------------------------------------------------------------------------------------ > Marc Tajchman > Laboratoire de Génie Logiciel et de Simulation > Software Engineering and Computer Simulation Laboratory > CEA-DEN/DANS/DM2S/SFME/LGLS > Tél : +33/1 69 08 73 27 > Fax : +33/1 69 08 52 42 > mailto:marc.tajch...@cea.fr > ------------------------------------------------------------------------------------ > > > Ce message électronique et tous les fichiers attachés qu'il contient > sont confidentiels et destinés exclusivement à l'usage de la personne > à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, > merci d'en avertir immédiatement son émetteur et de ne pas en conserver > de copie. > > This e-mail and any files transmitted with it are confidential and > intended solely for the use of the individual to whom they are addressed. > If you have received this e-mail in error please inform the sender > immediately, without keeping any copy thereof. > > > > > -------- Message d'origine-------- > De: TAJCHMAN Marc > Date: mar. 22/09/2009 00:35 > À: x10-users@lists.sourceforge.net > Objet : Transfert between places > > Hi, > > I have a array distributed on 2 places and I want to copy a line of array > coefficients to another line > (i.e. a(0, j) <- a(1, j) for j=0 to 9). Both lines are on different places. > > What is the preffered way to do that ? > > Below there is a small example (each value is transfered separately). > It works, but I find my solution neither elegant neither efficient. > > Suggestions are welcome. > > Thanks in advance. > Marc > > //========================================================= > // example > > import x10.io.Console; > import x10.util.Timer; > > public value test10 > { > public static def println(s:String) = Console.OUT.println(s); > public static def print(s:String) = Console.OUT.print(s); > public static def now():double = Timer.nanoTime() * 1e-9; > > val a:Array[double]; > > def this() { > R : Region = Region.makeRectangular([0,0], [1,9]); > D : Dist = Dist.makeCyclic(R, 0); > a = Array.make[double](D, ((i,j):Point) => 10*i+j as Double) ; > } > > def output(val s : String) { > println("\n" + s); > for (p in a.dist.places()) > at (p) { > println("place : " + here); > for ((i,j): Point in a.dist.get(p)) > print(" " + a([i,j])); > println(""); > } > } > > def transfert() { > for ((i,j): Point in a.dist.get(Place.places(0))) > a([i,j]) = at (Place.places(1)) a([1-i,j]); > } > > static public def main(args : Rail[String]) { > > t:test10 = new test10(); > > t.output("before copy"); > t.transfert(); > t.output("after copy"); > } > > } > > > ------------------------------------------------------------------------------------ > Marc Tajchman > Laboratoire de Génie Logiciel et de Simulation > Software Engineering and Computer Simulation Laboratory > CEA-DEN/DANS/DM2S/SFME/LGLS > Tél : +33/1 69 08 73 27 > Fax : +33/1 69 08 52 42 > mailto:marc.tajch...@cea.fr > ------------------------------------------------------------------------------------ > > > Ce message électronique et tous les fichiers attachés qu'il contient > sont confidentiels et destinés exclusivement à l'usage de la personne > à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, > merci d'en avertir immédiatement son émetteur et de ne pas en conserver > de copie. > > This e-mail and any files transmitted with it are confidential and > intended solely for the use of the individual to whom they are addressed. > If you have received this e-mail in error please inform the sender > immediately, without keeping any copy thereof. > > > > > -------- Message d'origine-------- > De: TAJCHMAN Marc > Date: dim. 20/09/2009 12:30 > À: x10-users@lists.sourceforge.net > Objet : Help for distributed arrays > > Hi everyone, > > Thanks for helping me on previous messages (especially Igor). > > Below are 2 versions of a test (defining and accessing a distributed array on > several places). > This is a variation of an example code from X10 distribution > (EncapsulatedArray2D). > > The first version is (apparently) working well but the second one launches > several x10.lang.BadPlaceException. > > The differences are : > > - first version : the distributed array is created and accessed only from the > static main function > - second version : the array is now a member of the class containing the main > function. It's created inside the class constructor and accessed from other > class method. > > Thanks a lot for any suggestion. > > Marc > > // ===================================================== > // working code > public class test8 { > > static def println(s:String) = Console.OUT.println(s); > static def print(s:String) = Console.OUT.print(s); > > static value bloc{ > val m_array: Array[double]; > def this(val a_array: Array[double]): bloc = { > m_array=a_array; > } > def init(val i:int) : Void = { > for (val (j): Point(1) in m_array) > m_array([j])= 10*j + i; > } > def output() : Void = { > for (val (j): Point(1) in m_array) { > println(" "+j+" : " + m_array([j])); > } > } > } > > > public static def main(a: Rail[String]) : void { > > val R : Region = [1..5]; > val r : Region = [1..3]; > > val D = Dist.makeCyclic(R, 0); > val A = Array.make[bloc] > (D, (p:Point) => > new bloc(Array.make[double](r->here,(Point)=>0.0D))); > > finish ateach (val (i): Point in D) > A([i]).init(i); > > for (val p in A.dist.places()) > at(p) { > val r : Region = A.dist.get(here); > for ((i): Point in r) { > println("subdomain "+i+" place = "+ here); > A([i]).output(); > println(""); > } > } > } > } > > // ======================================================== > // non working version > > public class test8c { > > val A : Array[bloc]; > > static def println(s:String) = Console.OUT.println(s); > static def print(s:String) = Console.OUT.print(s); > > static value bloc{ > val m_array: Array[double]; > def this(val a_array: Array[double]): bloc = { > m_array=a_array; > } > def init(val i:int) : Void = { > for (val (j): Point(1) in m_array) > m_array([j])= 10*j + i; > } > def output() : Void = { > for (val (j): Point(1) in m_array) { > println(" "+j+" : " + m_array([j])); > } > } > } > > def init() { > finish ateach (val (i): Point in A.dist) > A([i]).init(i); > } > > def output() { > for (val p in A.dist.places()) > at(p) { > val r : Region = A.dist.get(here); > for ((i): Point in r) { > println("subdomain "+i+" place = "+ here); > A([i]).output(); > println(""); > } > } > } > > def this() { > > val R : Region = [1..5]; > val r : Region = [1..3]; > > val D = Dist.makeCyclic(R, 0); > A = Array.make[bloc] > (D, (p:Point) => > new bloc(Array.make[double](r->here,(Point)=>0.0D))); > } > > public static def main(a: Rail[String]) : void { > val t : test8c = new test8c(); > t.init(); > t.output(); > } > } > > > > > > > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > X10-users mailing list > X10-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/x10-users > ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users