Hi

Here is what I got running your program on a PPC machine (SLES11) with 4 
Places


at Place print
3 3 3 3 3
print at Place
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Finished
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 


It seems the "missing elements" are flushed out when the program 
terminates.  Also note I'm using the latest X10 compiler -- I didn't try 
2.1.2 version though.

As to your second question to copy data from DistArray to Array, I don't 
believe there is an easier way (than assign value element by element). 
However, in DistArray there is a protected field chacheRaw that is of type 
IndexedMemoryChunck, which can be used to copy or construct Arrays. Unless 
you're building additional classes to array library, this field, 
unfortunately, is not accessible.


Cheers,

Jim Xia

Compiler Testing, X10 & XLF
IBM Toronto Lab at 8200 Warden Ave,
Markham, On, L6G 1C7
905-413-3444


Kröhnert, Manfred <manfred.kroehn...@kit.edu> wrote on 06/08/2011 08:14:05 
AM:

> [image removed] 
> 
> Re: [X10-users] Printing the content of a DistArray + extracting 
> DistArray content
> 
> Kröhnert, Manfred 
> 
> to:
> 
> Mailing list for users of the X10 programming language 
> 
> 06/08/2011 08:14 AM
> 
> Please respond to Mailing list for users of the X10 programming language 

> 
> Hi,
> 
> I just replaced the OUT.print() calls with OUT.println() and now all
> values get printed on the screen.
> 
> So it really seems to be the problem that the streams at other 
> places do not always get flushed.
> 
> Best,
> 
> Manfred
> 
> Am 08.06.2011 um 13:46 schrieb David P Grove:
> 
> > 
> > I think what you are seeing is that each place has it's own 
Console.OUT and
> > OUT is only flushed on newlines.  The only newlines are happening  at 
place
> > 0, so only the OUT stream at place 0 is getting flushed.
> > 
> > Arguably we should be flushing OUT in all places as part of tearing 
down
> > the program execution,  but I don't think we currently do that.
> > 
> > --dave
> > 
> > 
> > "Kröhnert,Manfred" <manfred.kroehn...@kit.edu> wrote on 06/08/2011 
07:36:54
> > AM:
> > 
> >> Hi everybody,
> >> 
> >> I have the following code (X10 v2.1.2):
> >> 
> >>        val array = new Array[Int](20,  3);
> >>        val dist = Dist.makeBlock(array.region);
> >>        val distArray = DistArray.make(dist, ([i]: Point) => 
array(i));
> >> 
> >>        Console.OUT.println("at Place print");
> >>        for ([p]: Point in distArray.dist) {
> >>            at(distArray.dist(p)) {Console.OUT.print(distArray(p) + "
> > ");}
> >>        }
> >> 
> >>        Console.OUT.println("\nprint at Place");
> >>        for ([p]: Point in distArray.dist) {
> >>            Console.OUT.print((at(distArray.dist(p)) distArray(p)) + "
> > ");
> >>        }
> >>        Console.OUT.println("\nFinished");
> >> 
> >> If I run the code with X10_NPLACES=1 I get the following expected 
output:
> >> 
> >> at Place print
> >> 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
> >> print at Place
> >> 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
> >> Finished
> >> 
> >> However, running the same code with X10_NPLACES=4 prints this (not
> >> expected by me):
> >> 
> >> at Place print
> >> 3 3 3 3 3
> >> print at Place
> >> 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
> >> Finished
> >> 
> >> My possible explanation is that the use of Console.OUT is only
> >> allowed in the home place of the running program or is something
> >> different causing this behaviour?
> >> 
> >> I also have one other question.
> >> To copy the values of a DistArray into a normal Array I am currently
> >> iterating over the DistArray and copying the values one after the
> >> other into the Array.
> >> Does an easier/shorter way exist to achieve this?
> >> 
> >> Best Regards,
> >> 
> >> Manfred
> >> 
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to