Dear David, Thank you very much for your very beneficial reply, it helped me a lot so basically what I did right now is that I have a matrix M of type (DistArray) which contains Array[double] in which these arrays are distributed and a vector V of type (DistArray) which also contains Array[double] and its also distributed as follows:
M : V: --------------------------- ------- | A B I J | | X | | C D K L | | Y | | E F M N | | Z | | G H O P | | R | --------------------------- ------- where AB,C,D,E,F,G,H are in place 0 also X,Y and I,J,K,L,M,N,O,P are in place 1 also Z,R so that multiplication could happen locally but my problem is when I want to sum up all the results in a global linear array called result which is at place 0 when ever i want to add those elements that reside at place 1 to the values of the result array, a bad place exception occurs. so how can I pass an array (or the values of the array) that resides at place 1 to the result array that resides at place 0? Thank you Mohammed @KAUST On Fri, Jul 9, 2010 at 1:33 PM, David P Grove <gro...@us.ibm.com> wrote: > > Hi, > > Trying to paraphrase the question, I think you are asking what X10 > classes provided by the standard library support indexed addressing (a > (i,j.k)) and store their elements in memory in a format that is compatible > with passing a pointer to the elements (or a subset of the elements) to a > native C/BLAS routine that is expecting a C-style []. Is this right? > > In 2.0.4, there are two primitive data types that support this: Rail > and ValRail. Both of these have a raw() method that gets you a pointer to > the C-level storage. Built on top of Rail we also have Array, DistArray, > and DistributedRail. Array is the simplest of these, it is a single-place > k-dimensional array that maps its data elements into a backing Rail using a > row-major layout (like C, not like Fortran). DistArray is a multi-place > k-dimensional array that divides the data elements (according to the Dist > chose: block, blockCyclic, etc) among places and then in each place maps > the data elements into a different backing rail using a row-major layout. > For both Array and DistArray you can use the raw() method (which is public > for Array, but not for DistArray) to get the backing Rail with the data and > pass it to native code. > DistributedRail is a little different. Instead of mapping each > index > to a single data value found in one place, it maps each index to a > different data element in each place. It gives you the abstraction of a > different Rail in each place that have the same indices, but potentially > different data elements at each place. The other interesting piece of > DistributedRail is that it provides collective reduction operations that > allow you to combine the Rails from each place. Since the backing data > structure here is a Rail, you can pass it to native routines. You could > think of DistArray as providing a global-index and DistributedRail of > providing a local-index API to approximately the same low-level storage: a > Rail at each place that is used to store data elements. > > In 2.0.5 (and the current svn head) things are a little different. > We've introduced a lower-level IndexedMethodChunk class, and Array is now > built on top of it instead of ontop of Rail. Similar concepts apply > though. > > If you wanted to, you can also define a DistArray of some other > object/indexed data structure. For example of this, you can take a look at > our SSCA1 implementation > (https://x10.svn.sf.net/svnroot/x10/benchmarks/trunk/SSCA1/x10). Here > there's a DistArray that contains 1 point for each place. At each place > the array contains a pointer to an object that in turn contains several > Rail and ValRail objects. You could also have a DistArray[Array[double]] if > you want to think about a local-index space at each place instead of a > global-index space across the whole DistArray. > > Hope this is helpful. If I missed the point of your question, please let > me know and I'll try again. > > --dave > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > X10-users mailing list > X10-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/x10-users > -- Thank you for your concern. Regards, Mohammed El Sayed ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users