I have a question on Distributed Arrays and Reductions.  I wrote a very simple 
program that I thought would create a local array, distribute it to a 
DistArray, then "reduce" to add up the elements.

It appears that I am not understanding the creation of the DistArray in some 
fundamental way.  Using the below to distribute my array into the DistArray, it 
seems to then only operate against the first 8 elements.

I need to do a two step creation like this as my primary program actually 
builds an Array and then puts the results into the distributed array like below.

My guess is that the initializer is incorrect, is this a fundamental 
misunderstanding of "Point"?

public class TestArrays {
    public static def main(args: Array[String]) {
        val ranks = new Array[Int](100, (i:Int) => i);
        Console.OUT.println("ranks="+ranks);            
        val initializer = (i:Point) => {
                return ranks(i);
        };
        val D = Dist.makeUnique();
        val distList = DistArray.make[Int](D, initializer);
        Console.OUT.println("distList numPlaces="+D.numPlaces()+", 
distList="+distList);        
        val rResult = distList.reduce ( (x:Int, y:Int) => x + y, 0);
        Console.OUT.println("rResult="+rResult);
    }
}

And here is the result of a run:
ranks=[0,1,2,3,4,5,6,7,8,9...(omitted 90 elements)]
distList numPlaces=8, 
distList=DistArray(Dist([0..0]->0,[1..1]->1,[2..2]->2,[3..3]->3,[4..4]->4,[5..5]->5,[6..6]->6,[7..7]->7))
rResult=28



Paul Monday
Parallel Scientific, LLC.
paul.mon...@parsci.com




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to