[Numpy-discussion] Shared memory ndarrays (update)

Sturla Molden sturla at molden.no
Mon Apr 11 14:47:28 EDT 2011

Den 11.04.2011 14:58, skrev Zbigniew Jędrzejewski-Szmek:
> Hi,
> it could, but you'd have to do the parsing of data yourself. So nothing
> fancy unless you want to reimplement numpy in Java :)

Not really. Only the data buffer is stored in shared memory. If you can 
pass the required fields to Java (shape, strides, sagment name, offset 
to first element), the memory mappred ndarray can be used by Java. 
(Doing it with JNI is trivial, I am not sure what Java's standard 
library supports.) Interop with C++, Fortran, C#, Matalab, whatever, can 
be done similarly.

> . But if you
> use a mmaped file as a backing for a numpy array of one of the types
> also available in Java (signed byte, short, int, long, float, double)
> and then map it on the Java side with DoubleBuffer or FloatBuffer or
> ..., then it seems straightforward enough.

Which is what we are doing, except that we are not memory mapping a 
physical file but a RAM segment with a filename.


More information about the NumPy-Discussion mailing list