Yes, every object has a place, that's the point of the PGAS paradigm. You
can access fields and methods of the object only in it's home place. Only
"global" methods and fields can be accessed everywhere.

You should use "!" to make sure you don't have ClassCastException for home
constraints.
When you compiled your program, you probably saw the warning: ZZZ dynamic
checks added.
If you compile with the parameter -STATIC_CALLS then the compiler will give
you errors instead of warnings, and you will know what to mark as "!".

On Tue, Jul 6, 2010 at 9:28 AM, mohammed elsaeedy <
mohammed.elsae...@kaust.edu.sa> wrote:

> Dear Yoav,
>
>
>     Thank you for your concern, here's the simple code I used:
> *
> public class Hello
> {
>
>    public static def main(var args: Rail[String]!) {
>        val h = new Hello();
>        val R:Region= [0..10];
>        val D:Dist(1)=Dist.makeBlock(R);
>        val a :DistArray[int](1) =DistArray.make[int](D, ((i):Point)=>i);
>
>        Console.OUT.println("NUm of children " +Place.numChildren(here.id
> ));
>        finish ateach((i):Point in a.dist())
>        {
>             h.myPrint(a,i);
>        }
>    }
>
>    public static def myPrint(a:DistArray[int](1),i:Int)
>    {
>        Console.OUT.println("a("+i+"): " +a(i)+" at Place: "+here.id);
>    }
>
> }*
>
> So basically if I removed the static keyword in the method, and I ran the
> application over only one process, it works just fine,
> but if I increase the number of processes, for example 2 processes,
> it would print those at place 0 but when it tries to print those at place 1
> it gives me the following exception
>
> *Uncaught exception at place 0: x10.lang.MultipleExceptions (home==1)
> x10.lang.ClassCastException (home==1): Hello{self.home==here}
>    at x10::lang::Throwable::fillInStackTrace()
>    at x10aux::throwException(x10aux::ref<x10::lang::Throwable>)
>    at Hello__closure__2::apply()
>    at x10::lang::Activity::run()
>    at x10_lang_Runtime__Worker__closure__0::apply()
>    at x10::lang::Runtime::runAtLocal(int,
> x10aux::ref<x10::lang::VoidFun_0_0>)
>    at
> x10::lang::Runtime__Worker::loop(x10aux::ref<x10::lang::Runtime__Latch>,
> bool)
>    at x10::lang::Runtime__Worker::apply()
>    at x10_lang_Runtime__Pool__closure__0::apply()
>    at x10::lang::Thread::thread_start_routine(void*)
>    at GC_inner_start_routine
>    at GC_call_with_stack_base
>    at GC_start_routine
>    at
>    at clone
>
> *I think* *because place 1 is trying to access the method which is at place
> 0, am I correct?
>
>
> Thank you again.
>
> On Mon, Jul 5, 2010 at 1:01 PM, Yoav Zibin <yoav.zi...@gmail.com> wrote:
>
> > could you email me the working version (with *static*), and then the
> > non-working version if it is non-static?
> > Feel free to also submit Jira items (http://jira.codehaus.org/) to the
> X10
> > project.
> >
> > On Sun, Jul 4, 2010 at 11:48 AM, mohammed elsaeedy <
> > mohammed.elsae...@kaust.edu.sa> wrote:
> >
> > > Dear Yoav,
> > >
> > >
> > >     Thank you very much, you were right I forgot to put the braces in
> the
> > > for loop (i:Point)--->(*(i)*:Point), when I ran it, I got thrown
> > exceptions
> > > so I guessed that was because of non-authorized memory accesses so I
> > > changed
> > > the definition of the function to *static*, and it worked pretty well.
> > > Do you have a more detailed explanation?
> > >
> > > Thank you again Yoav.
> > >
> > > On Sun, Jul 4, 2010 at 11:21 AM, Yoav Zibin <yoav.zi...@gmail.com>
> > wrote:
> > >
> > > > This error complains about the second Int parameter
> > > >
> > > > On Sunday, July 4, 2010, mohammed elsaeedy
> > > > <mohammed.elsae...@kaust.edu.sa> wrote:
> > > > > Dear Yoav,
> > > > >
> > > > >
> > > > >     The compiler should be able to infer that my array "a" is of
> one
> > > > > dimension, and I tried your proposal, and it gave me an error too
> > > > >
> > > > >
> > > > > "*Method myPrint(a:
> > > > > x10.array.DistArray[x10.lang.Int]{self.dist.region.rank==1},
> > > > > i: x10.lang.Int) in Hello{self==h, h.home==_place17626731,
> h!=null}
> > > > cannot
> > > > > be called with arguments (x10.array.DistArray[x10.lang.Int
> ]{self==a,
> > > > > a.dist.region.rank==1}, x10.array.Point{self==i}); Invalid
> Parameter.
> > > > >      expected type: x10.lang.Int
> > > > >      found: x10.array.Point{self==i}  *"
> > > > >
> > > > > I think the problem is in "*self==a*". Am I missing something?
> > > > >
> > > > > Thank you.
> > > > > Regards,
> > > > > Mohammed
> > > > >
> > > > >
> > > > > On Sun, Jul 4, 2010 at 10:26 AM, Yoav Zibin <yoav.zi...@gmail.com>
> > > > wrote:
> > > > >
> > > > >> The parameter is of type
> > > > >>
> > > > >> DistArray[int](1)
> > > > >> While the argument is
> > > > >>
> > > > >> DistArray[int]
> > > > >>
> > > > >> Thanks,
> > > > >> Yoav Zibin
> > > > >>
> > > > >> On 04/07/2010, at 09:14, mohammed elsaeedy <
> > > > mohammed.elsae...@kaust.edu.sa
> > > > >>  > wrote:
> > > > >>
> > > > >> > DistArray[int](1)
> > > > >>
> > > > >>
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > >> This SF.net email is sponsored by Sprint
> > > > >> What will you do first with EVO, the first 4G phone?
> > > > >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > > > >> _______________________________________________
> > > > >> X10-users mailing list
> > > > >> X10-users@lists.sourceforge.net
> > > > >> https://lists.sourceforge.net/lists/listinfo/x10-users
> > > > >>
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Thank you for your concern.
> > > > > Regards,
> > > > > Mohammed El Sayed
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > This SF.net email is sponsored by Sprint
> > > > > What will you do first with EVO, the first 4G phone?
> > > > > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > > > > _______________________________________________
> > > > > X10-users mailing list
> > > > > X10-users@lists.sourceforge.net
> > > > > https://lists.sourceforge.net/lists/listinfo/x10-users
> > > > >
> > > >
> > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > This SF.net email is sponsored by Sprint
> > > > What will you do first with EVO, the first 4G phone?
> > > > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > > > _______________________________________________
> > > > X10-users mailing list
> > > > X10-users@lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/x10-users
> > > >
> > >
> > >
> > >
> > > --
> > > Thank you for your concern.
> > > Regards,
> > > Mohammed El Sayed
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > This SF.net email is sponsored by Sprint
> > > What will you do first with EVO, the first 4G phone?
> > > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > > _______________________________________________
> > > X10-users mailing list
> > > X10-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/x10-users
> > >
> >
> >
> ------------------------------------------------------------------------------
> > This SF.net email is sponsored by Sprint
> > What will you do first with EVO, the first 4G phone?
> > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > _______________________________________________
> > X10-users mailing list
> > X10-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/x10-users
> >
>
>
>
> --
> Thank you for your concern.
> Regards,
> Mohammed El Sayed
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> X10-users mailing list
> X10-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x10-users
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to