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

Reply via email to