[Numpy-discussion] ndarray allocation question
David Doukhan
david.doukhan@gmail....
Mon Apr 9 23:49:23 CDT 2007
Hi!
I'm writing you this mail because I would like to do "advanced" use of
ndarray memory allocation.
So here is a short description of my problem:
I'm interfacing multidimensionnal Numpy array to C using the ctypes module.
For now, there is no problem.
The C program that will use the pointer to the data of the array runs on a
CellBE architecture.
The consequences are:
* the adress of the beginning of the data of the array must be a multiple a
16 bytes (that could be specified using the attribute 'align' of dtype)
* the memory allocated MUST be a multiple of 16 bytes, and that's my current
problem, because I didn't find a way to specify it using dtypes...
For now, the only arguments that I know that could be given to a dtype
constructor are "names", "format", "offsets", "titles",
"align"<numpy-discussion@scipy.org>
Does any other arguments exist?
I could do the assumption that try to access to the data outside the last
element of the array won't produce a segfault, but, i would like to avoid as
much as possible doing so dirty stuffs :-))
So, do the think there is a "clean" way to do what I want. For example,
asking for an array of 2 lines and 7 columns of float32, so that the adress
of the biginning of the data would be a multiple of 16 bytes (that's already
possible) AND beeing sure that the allocated memory for the data would be
at least 16 * sizeof(float32), instead of 14*sizeof(float32).
Thanks for your help!
--
David Doukhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070410/7574115b/attachment.html
More information about the Numpy-discussion
mailing list