Resending attachment to list.

Run configuration:

$ > x10c++ ../src/Broadcast.x10 -O -NO_CHECKS -o Broadcast && export
X10_NPLACES=4 X10_RESILIENT_MODE=1 && Broadcast 2

This compiles and starts the program. The parameter tells, which place to
exclude from the reduction.

gcc used: 2.5.1
java used: 1.8.0_31


On 16 February 2015 at 03:48, Marco Bungart <m.bung...@gmx.net> wrote:

> Hi there,
>
> I just cannot wrap my mind around the behaviour I am observing right now.
>
> When compiling with the c++ backend, the program appended throws an
> exception at line 51 (broadcastFlat(...)).
> However, if you uncomment the try-catch-block (line 22-33), the code
> will run just fine. Is this behavior intentional? For my intuition, the
> code should run without the try-catch-block. It looks to me like the
> SparsePlaceGroup does not actually "skip" Place(2) despite it not being
> in the rail places.
>
> When compiling and running with the java backend, the program throws
> exceptions, with and without the try-catch-block.
>
> Cheers,
> Marco
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> _______________________________________________
> X10-users mailing list
> X10-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x10-users
>
import x10.util.Team;

public class Broadcast
{
    public static def main(args:Rail[String])
    {
        val P = Place.numPlaces();
        val places:Rail[Place] = new Rail[Place](P - 1);
        val filterOut:Long = Long.parse(args(0));
        var index:Long = 0;
        for (place:Long in 0..(P - 1))
        {
            if (filterOut == place)
            {
                continue;
            }

            places(index++) = Place(place);
        }
        Console.OUT.println("Places for group : " + places);

        // try
        // {
        //     at (Place(filterOut))
        //     {
        //         System.killHere();
        //     }
        // }
        // catch (val e:Exception)
        // {
        //     Console.OUT.println(e);
        //     Console.OUT.println(places);
        // }

        val init:() => Container = () =>
                                   {
                                       return new Container(Runtime.hereLong());
                                   };

        val group:PlaceGroup = new SparsePlaceGroup(places);

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

        val appeal:() => void = () =>
                                {
                                    Console.OUT.println(  here + ": "
                                                        + plh().value);
                                };

        Console.OUT.println(here + ": starting appeal.");
        finish
        {
            group.broadcastFlat(appeal);
        }

        Console.OUT.println(here + ": appeal done.");
        val team:Team = new Team(group.filterDeadPlaces());

        var result:Result = new Result(0);

        val sumRef:GlobalRef[Result]
            = new GlobalRef[Result](result);

        val root:Place = here;
        val reduceFunction:() => void = () =>
                                        {
                                            if (sumRef.home == here)
                                            {
                                                sumRef().setResult
                                                    (team.reduce(root
                                                                 , plh().value
                                                                 , Team.ADD));
                                            }
                                            else
                                            {
                                                team.reduce(root
                                                            , plh().value
                                                            , Team.ADD);
                                            }
                                        };
        Console.OUT.println(here + ": starting reduction.");
        finish
        {
            group.broadcastFlat(reduceFunction);
        }
        Console.OUT.println(here + ": reduction done.");
        Console.OUT.println(here + ": result = " + result.getResult());
    }
}

class Container
{
    val value:Long;

    public def this(val value:Long) : Container
    {
        this.value = value;
    }
}

class Result
{
    private var result:Long;

    public def this(val result:Long) : Result
    {
        this.result = result;
    }

    public def getResult() : Long
    {
        return (this.result);
    }

    public def setResult(val result:Long) : void
    {
        this.result = result;
    }
}
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to