[Numpy-discussion] From CorePy: New ExtBuffer object

Stéfan van der Walt stefan@sun.ac...
Mon Jun 8 20:42:22 CDT 2009


Hi,

Just a heads-up on something they're talking about over at CorePy.

Regards
Stéfan

---------- Forwarded message ----------
From: Andrew Friedley <afriedle@osl.iu.edu>
Date: 2009/6/8
Subject: [Corepy-devel] New ExtBuffer object
To: CorePy Development <corepy-devel@osl.iu.edu>


I wrote a new buffer object today, called ExtBuffer, that can be used
with libraries/objects that support the Python 2.6 buffer interface
(e.g. NumPy).  This brings page-aligned memory (and huge-page) support
to anything that can use a buffer object (eg NumPy arrays).  ExtBuffer
can also be initialized using a pointer to an existing memory region.
This allows you, for example, to set up a NumPy array spanning a Cell
SPU's memory mapped local store, accessing LS like any other NumPy
array.

The ExtBuffer is included as part of the 'corepy.lib.extarray' module,
and can be used like this:

import corepy.lib.extarray as extarray
import numpy

buf = extarray.extbuffer(4096, huge = True)
array = numpy.frombuffer(buf, dtype=numpy.int32)

I wrote a some documentation here:

http://corepy.org/wiki/index.php?title=Extended_Array

If anyone has any questions, thoughts, ideas, bugs, etc, please let me know!

Andrew
_______________________________________________
Corepy-devel mailing list
Corepy-devel@osl.iu.edu
http://www.osl.iu.edu/mailman/listinfo.cgi/corepy-devel


More information about the Numpy-discussion mailing list