Hi there,

the appended program shows nondeterministic behaviour. Sometimes it finishes, most times it runs into an endless loop. It happends with both native and managed X10. I am using the repository revision 29129 of X10, java 1.8.0_40 and gcc 4.8.2.
With an older version of X10 (2.4.3.2), the program terminates just fine.
One observation I was able to make: the program terminated only, if X10_RESILIENT_MODE was set to 1. If it was unset, I was not able to observe termination (but this could be pure coincidence...).

Environment variables and compile-command used (command line parameter only prevents flooding your console):

$ >export X10_NPLACES=2 X10_NTHREADS=1
$ >x10c++ ../src/Hello.x10 -o Hello && ./Hello 5000000

Could someone explain to me, what is going wrong or what changed?

Thanks in advance,

Marco
import x10.compiler.Volatile;

import x10.xrx.Runtime;

public class Hello {

    @Volatile transient var finished:Boolean = false;

    public static def main(args:Rail[String])
    {
        val group:PlaceGroup = Place.places();

        val init:() => Hello = () =>
                               {
                                   return (new Hello());
                               };

        val plh:PlaceLocalHandle[Hello]
            = PlaceLocalHandle.makeFlat(group, init);

        val maxI:Long = Long.parseLong(args(0));

        Console.OUT.println(here + ": starting.");
        at (Place(1)) async
        {
            Console.OUT.println(here + ": sleeping.");
            System.sleep(100);
            Console.OUT.println(here + ": stopping Place(0).");
            at (Place(0)) async
            {
                plh().finished = true;
                Console.OUT.println(here + ": finished=true.");
            }
        }
        var i:Long = 0;
        while (!plh().finished)
        {
            ++i;
            if (i >= maxI)
            {
                Console.OUT.println(here + ": probing.");
                i = 0;
            }
            Runtime.probe();
        }
        Console.OUT.println(here + ": stopping.");
    }

}
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to