On Dec 21, 2012, at 2:32 PM, Siegmar Gross wrote:

> Today I found something about the memory layout of 2D matrices in
> Java (I'm not sure if the information is valid). Java has one 1D array
> with pointers to every 1D row. All elements of a row are stored in
> contiguous memory. Different rows can be stored in "arbitrary" places
> so that a 2D matrix is normally not stored in a contiguous memory area.

This makes it sound just like C -- in that if you want a contiguous chunk of 
memory for an N dimensional array, you need to write a wrapper method that 
allocates a contiguous chunk of memory and then sets all the pointers properly 
so that successive rows/columns/etc. point to the Right places in memory.

This wrapper will likely need to be written in C.

> In fact it would be better in that case if the extent of a new column
> type is equal to the extent of the base type of the array.

Yes, via a "resized" type.  The basic MPI bindings should do pretty much 
exactly what the MPI C bindings should do.

> It would also
> be necessary that a new column type is something like an array itself
> pointing for example to the first element of each row (perhaps it is
> even possible to use the Java pointer array of the 2D matrix). To make
> things worse, Java allows non-rectangular matrices (but they could be
> prohibited for MPI). Perhaps this is no news to you, but I wanted to
> mention it in case you also didn't know (as I said I'm not sure if the
> information about 2D Java matrices is true).

Nope, I don't know very much about Java at all.  :-)

-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/


Reply via email to