Aniruddha,
Actually, this looks like a different bug. When processing local
declarations, the compiler does not check the "value"ness of the local
being declared, and so e ends up referencing the same object as f (which
is not a value array). Thanks for the report.
Igor
"Shet, Aniruddha G." wrote on 04/10/2007 09:15:07 PM:
> Igor,
>
> This probably is the same problem, but just to be sure...
>
> double [.] f = new double [ [1:5, 1:5] ];
> final double value [.] e = f;
>
> e should be a value copy of the local reference array f and hence
> accessible from any place. But a BadPlaceException is currently thrown
> due to the bug. Is my understanding correct?
>
> Thanks,
> Aniruddha
>
> -----Original Message-----
> From: Igor Peshansky
> Sent: Wednesday, April 04, 2007 1:04 PM
> To: Shet, Aniruddha G.
> Cc: x10-users<at>lists.sourceforge.net
> Subject: Re: [X10-users] Array assignment & update/overlay
>
> Igor Peshansky wrote on 04/04/2007 12:24:30 PM:
>
> > Aniruddha,
> >
> > No, b *is* a copy, but not a value array.
> >
> > This is actually a bug in the X10 runtime libraries' implementation.
> > The restriction ("|") operator does not create a value array, even if
> > applied to a value array. That's why you get the place checks, etc.
> > We'll need to fix this.
> >
> > In the meantime, you can turn off place checks using the
> > -BAD_PLACE_RUNTIME_CHECK=false runtime option. If you don't want to
> > do that, you can make sure a value copy is created by using the
> > following snippet:
> >
> > final double value [.] a_sub = a | subD; final double value [.] b
> > (point p) { return a_sub[p]; };
>
> Sorry, I meant
>
> final double value[] b = new double[a_sub.distribution] (point p) {
> return a_sub[p]; };
>
> > (Vijay will, hopefully, correct me if this is wrong).
> > Igor
> >
> > "Shet, Aniruddha G." wrote on 04/04/2007 11:09:29 AM:
> >
> > > Igor,
> > >
> > > In the code that I sent, if b were declared as
> > >
> > > final double value [.] b = a | subD;
> > >
> > > can I expect a local copy to be created or is b treated only as a
> > > reference to a section of a? I see that a BadPlaceException is
> > > thrown when I try to access an element in b, which indicates that no
>
> > > local
> copy
> > > is created.
> > >
> > > Thanks,
> > > Aniruddha
> > >
> > > -----Original Message-----
> > > From: Igor Peshansky
> > > Sent: Wednesday, April 04, 2007 1:13 AM
> > > To: Shet, Aniruddha G.
> > > Cc: x10-users<at>lists.sourceforge.net
> > > Subject: RE: [X10-users] Array assignment & update/overlay
> > >
> > > Aniruddha,
> > >
> > > Thanks for the detailed report. I've reproduced the first problem
> here.
> > >
> > > We'll debug it and get back
> > > to you. In the meantime, since you're on an SMP, you can turn off
> > > BadPlaceExceptions by using the -BAD_PLACE_RUNTIME_CHECK=false
> option.
> > >
> > > The second problem is a bug, but only because the code to throw the
> > > appropriate kind of exception never got written, so an assertion is
> > > tripped instead.
> > > Igor
> > >
> > > "Shet, Aniruddha G." wrote on 04/03/2007 11:20:10 PM:
> > >
> > > > Hi Igor,
> > > >
> > > > In the foll piece of code, the activity at place 0 is trying to
> update
> > >
> > > > a locally allocated reference array with a block from a
> > > > distributed value
> > > > array:-
> > > >
> > > > public class test {
> > > > final region R = [1:20, 1:20];
> > > > final dist D = dist.factory.block(R);
> > > > final double value [.] a = new double value [D] (point
> [i,j])
> > > > {return i+j;};
> > > >
> > > > public void run() {
> > > > async(here) {
> > > > double [.] b = new double [ [15:19, 1:5]
> ];
> > > > final dist subD = D | [15:19, 1:5];
> > > > b.update(a | subD);
> > > > }
> > > > }
> > > >
> > > > public static void main(String[] args) {
> > > > new test().run();
> > > > }
> > > > }
> > > >
> > > > This code throws the foll error when run with 4 places:-
> > > >
> > > > Exception in thread "pool-0-thread-0: Main Activity"
> > > > BadPlaceException(dist. array, var location=place(id=2) access at
> > > > place=place(id=0))
> > > > at x10.lang.Runtime.hereCheckPlace(Runtime.java:313)
> > > > at x10.array.DoubleArray.get(DoubleArray.java:103)
> > > > at x10.array.DoubleArray.get(DoubleArray.java:100)
> > > > at x10.array.DoubleArray.update(DoubleArray.java:389)
> > > > at test$2.runX10Task(test.java:133)
> > > > at
> > > >
> x10.runtime.InvocationStrategy$DefaultStrategy.invokeX10Task(Invocatio
> > > > nS
> > > > trategy.java:57)
> > > > at x10.runtime.Activity.run(Activity.java:192)
> > > > at
> > > >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecu
> > > > to
> > > > r.java:665)
> > > > at
> > > >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
> > > > ja
> > > > va:690)
> > > > at java.lang.Thread.run(Thread.java:799)
> > > >
> > > >
> > > >
> > > > I would like some more clarifications here --
> > > >
> > > > -- If I were to def b as "double [.] b = new double [ [1:5, 1:5]
> ]"
> > > > and leave subD unchanged, then I get the error:-
> > > >
> > > > Exception in thread "pool-0-thread-0: Main Activity"
> > > > java.lang.AssertionError
> > > > at x10.array.DoubleArray.update(DoubleArray.java:382)
> > > > at test$2.runX10Task(test.java:133)
> > > > at
> > > >
> x10.runtime.InvocationStrategy$DefaultStrategy.invokeX10Task(Invocatio
> > > > nS
> > > > trategy.java:57)
> > > > at x10.runtime.Activity.run(Activity.java:192)
> > > > at
> > > >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecu
> > > > to
> > > > r.java:665)
> > > > at
> > > >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
> > > > ja
> > > > va:690)
> > > > at java.lang.Thread.run(Thread.java:799)
> > > >
> > > > b here has the same shape and size as before, but a different
> > > > index
> > > set.
> > > > I feel that such a capability is desirable.
> > > >
> > > > -- Correct me if I am wrong in saying that if two arrays have
> > > > identical regions but different distributions, then
> > > > assignment/update/overlay operations should run correctly so long
> > > > as
>
> > > > the locality rule is not violated.
> > > >
> > > > Thanks,
> > > > Aniruddha
> > > > -----------------------------------------------------------
> > > > Aniruddha G. Shet |Email: [EMAIL PROTECTED]
> > > > Oak Ridge National Laboratory |Phone: +1 (865) 576 5606
> > > > http://www.csm.ornl.gov/~anish12/ |Fax: +1 (865) 576 5491
> > > > -----------------------------------------------------------
> > > >
> > > > -----Original Message-----
> > > > From: Igor Peshansky
> > > > Sent: Tuesday, April 03, 2007 9:41 PM
> > > > To: Shet, Aniruddha G.
> > > > Cc: x10-users<at>lists.sourceforge.net
> > > > Subject: Re: [X10-users] Array assignment & update/overlay
> > > >
> > > > Shet, Aniruddha G. wrote on 04/03/2007 09:25:03 PM:
> > > >
> > > > > Hi,
> > > > >
> > > > > My understanding is that array assignment and update/overlay
> > > > > operations are not designed to operate on arrays that do not
> having
> > > > > matching distributions, even though they may have matching
> regions?
> > > > >
> > > > > I am seeing that an activity that tries to update a local
> reference
> > > > > type array with a subdistribution of a global array that is
> > > > > final value type fails with BadPlaceException. The local array
> > > > > and the subdistribution have identical regions. The locality
> > > > > rule is not being
> > > >
> > > > > violated here. Is the mismatch of distributions the reason for
> > > > failure?
> > > >
> > > > Hi, Aniruddha,
> > > >
> > > > This behavior sounds like a bug. The way you described it, it
> > > > certainly does not correspond to the X10 language definition.
> > > >
> > > > It would help greatly in debugging this problem if you could
> > > > reduce
> it
> > >
> > > > to a simple (and preferably short) test case. Feel free to post
> > > > it
> to
> > >
> > > > the list or enter it in Bugzilla. It would also help if you could
>
> > > > show the full stack trace of the BadPlaceException you're getting.
> > > > 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/)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users