Jim LaGrone <jlagr...@cs.uh.edu> wrote on 08/28/2009 04:31:04 PM:

> Resending for mailing list.
> 
> On Aug 28, 2009, at 2:25 PM, Igor Peshansky wrote:
> 
> >>  Using this code:
> >>
> >>  val norms = Array.make[Double](Dist.makeUnique(), (Point)=>0.0);
> >>  finish for ( p in distS.places() ) async(p){
> >>     for( (i,j) in distS | p ){
> >>        norms(p.id) += Math.sqrt(S(i,j).real*S(i,j).real +
> >>              S(i,j).image*S(i,j).image);
> >>     }
> >>  }
> >>
> >>  I get this output for places 3, 2, & 1:
> >>
> >> BAD PLACE EXCEPTION
> >> BAD PLACE EXCEPTION
> >> BAD PLACE EXCEPTION
> >> x10.lang.BadPlaceException: object=State Object {/*object values
> >> omitted*/} access at place=(Place 3)
> >>  at x10.runtime.Runtime.placeCheck(Runtime.java:699)
> >>  at State$2.apply(State.java:674)
> >>  at x10.runtime.Activity.now(Activity.java:222)
> >>  at x10.runtime.Activity.run(Activity.java:156)
> >>  at x10.runtime.Worker$3.apply(Worker.java:330)
> >>  at x10.runtime.impl.java.Runtime.runAt(Runtime.java:96)
> >>  at x10.runtime.Worker.loop(Worker.java:317)
> >>  at x10.runtime.Worker.join(Worker.java:246)
> >>  at x10.runtime.Pool$5.apply(Pool.java:418)
> >>  at x10.runtime.impl.java.Runtime.runAt(Runtime.java:96)
> >>  at x10.runtime.Pool.join(Pool.java:410)
> >>  at x10.runtime.FinishState.waitForFinish(FinishState.java:83)
> >>  at x10.runtime.Runtime.stopFinish(Runtime.java:1068)
> >>  at State.formImage(State.java:731)
> >>  at State.stage1(State.java:1417)
> >>  at RUN_knowledgeFormation.main(RUN_knowledgeFormation.java:466)
> >>  at
> > RUN_knowledgeFormation$Main$1.apply(RUN_knowledgeFormation.java:48)
> >>  at x10.runtime.Activity.now(Activity.java:222)
> >>  at x10.runtime.Activity.run(Activity.java:127)
> >>  at x10.runtime.Worker$3.apply(Worker.java:330)
> >>  at x10.runtime.impl.java.Runtime.runAt(Runtime.java:96)
> >>  at x10.runtime.Worker.loop(Worker.java:317)
> >>  at x10.runtime.Runtime.start(Runtime.java:143)
> >>  at RUN_knowledgeFormation$Main.main(RUN_knowledgeFormation.java:35)
> >>  at x10.runtime.impl.java.Runtime.run(Runtime.java:46)
> >>  at java.lang.Thread.run(Thread.java:613)
> >>
> >>
> >>
> >> A query on Place.MAX_PLACES returns 4 and I'm using a dual-core with
> >> Java backend.
> >>
> >> Any suggestions?
> >
> > Interesting.  The above code should work, unless S is a field of an
> > object that lives in place 0 (e.g., if S is really this.S).  If that
> > is the case, simply store S in a local variable (e.g.,
> > "val S = this.S") and let the async capture it.  Otherwise, I'd
> > suspect a bug in the Java backend implementation...
> 
> 
> This is slightly different code, but I realized later that this is 
> executed first. But this throws a similar x10.lang.BadPlaceException. 
> And yes, S is a member of State class. I have not yet attempted this 
> with C++ backend but will do so.
> 
> /* class members */
>   var regionS: Region{rank==2};
>   var distS: Dist{rank==2};
>   var S: Array[Complex](distS);
> 
> 
> /* code from method */
>    val real = tmp_fs_real;//Rail
>    val image = tmp_fs_image;//Rail
>    regionS = [0..N-1, 0..Mc-1];
>    distS = Dist.makeBlock(regionS,0);
> 
>    S = Array.makeVar[Complex](regionS, ((p):Point) => new Complex ()); 
>    val S = this.S;
>    finish{
>       for ( p in distS.places()) async (p){
>          for( (i1,j1) in regionS ){
>             S(i1,j1).real  = real(i1*Mc+j1);
>             S(i1,j1).image = image(i1*Mc+j1);
>          }
>       }
>    }
>    this.S = S;

Let me guess: real() and image() are instance methods of the State
class...  Again, you're attempting to invoke methods on an object
that lives in place 0 from other places, which won't work.

Basically, the rule of thumb is: you cannot access state or invoke
instance methods via a remote reference.

If real() and image() could be made static, the above code should
work.
        Igor
-- 
Igor Peshansky  (note the spelling change!)
IBM T.J. Watson Research Center
XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/)
X10: Parallel Productivity and Performance (http://x10.sf.net/)


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to