On Tuesday, September 07, 2010 09:18:51 pm Christoph Pospiech wrote: > Hi, > > I was trying to do the equivalent of an MPI_Gather using code like this. > > finish for ( pt(i) in v_dst ) { > v_loc(i).copyFrom(0,v_dst(pt),0,vsize); > > where > static type Array1D = Array[Double]{rank==1}; > > global val v_dst: DistArray[Array1D]{rank==1}; > global val v_loc: Array[Array1D]{rank==1}; > > - the region for all objects of type Array1D is [0..vsize-1], > - the region for v_loc and v_dst is [0..number_of_places-1], > - the distribution for v_dst maps exactly one point to each place. > > The above code runs fine on one place. But on two places, it throws a > x10.lang.BadPlaceException: point (1) not defined at (Place 0). > pt(1) lives on place 1 by definition, so the exception is thrown correctly. > Means - the above code snippet is wrong. I tried about half a dozen > variants of the above, but no avail. > > How to do it right ?
Thinking it over, I am even more interested in the equivalent of an MPI_Reduce along the lines above. I could think of the following four strategies. 1. Gathering all data to an Array v_loc as described above, then (vector-) add the array elements of v_loc to get a single value of type Array1D. 2. Call Array1D.reduce(). The complicated part is the definition of an appropriate reduction function Array1D.+ (Array1D, Array1D) => Array1D. 3. Change the data type of v_dst to DistArray[Double] with region [0..vsize-1, 0..number_of_places-1]. Then try to use the ordinary reduce() after restricting the region to [x..x, 0..number_of_places-1], for each 0 <= x < vsize. This means that you have to execute vsize many reductions. 4. @Native call of MPI_reduce(). Apart from being unclear how to do this, it is not very X10-like. Anyone any suggestions on which of these is the most promising ? -- Mit freundlichen Grüßen / Kind regards Dr. Christoph Pospiech High Performance & Parallel Computing Phone: +49-351 86269826 Mobile: +49-171-765 5871 E-Mail: christoph.pospi...@de.ibm.com ------------------------------------- IBM Deutschland GmbH Vorsitzender des Aufsichtsrats: Erich Clementi Geschäftsführung: Martin Jetter (Vorsitzender), Reinhard Reschke, Christoph Grandpierre, Klaus Lintelmann, Michael Diemer, Martina Koederitz Sitz der Gesellschaft: Ehningen / Registergericht: Amtsgericht Stuttgart, HRB 14562 WEEE-Reg.-Nr. DE 99369940 ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users