Christoph Pospiech <christoph.pospi...@de.ibm.com> wrote on 09/07/2010 03:18:51 PM:
> 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 ? In 2.0.6 you can do finish ateach (pt(i) in v_dst) { val t = v_dst(pt); // note that v_dst(i) is slightly more efficient at (v_loc) v_loc(i).copyFrom(t); // or, alternatively (but not as efficiently) // v_dst(pt).copyTo(at (v_loc) v_loc(i)); } (the above copies the whole array). Igor -- Igor Peshansky (note the spelling change!) IBM T.J. Watson Research Center X10: Parallel Productivity and Performance (http://x10-lang.org/) XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/) "I hear and I forget. I see and I remember. I do and I understand" -- Confucius ------------------------------------------------------------------------------ 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