[Numpy-discussion] NumPy re-factoring project
Thu Jun 10 15:07:03 CDT 2010
On Jun 10, 2010, at 11:48 AM, Sturla Molden wrote:
> I have a few radical suggestions:
There are some good ideas there. I suspect we can't address all of them in the course of this re-factoring effort, but I really appreciate you putting them out there, because they are useful things to consider.
> 1. Use ctypes as glue to the core DLL, so we can completely forget about refcounts and similar mess. Why put manual reference counting and error handling in the core? It's stupid.
If we could get to a single core DLL, then perhaps this would work. It may be very difficult to actually get to that point though from where we are because there is a lot to the current CPython interface that would have to be re-thought. Right now, it looks like there is still a need for an interface layer.
> 2. The core should be a plain DLL, loadable with ctypes. (I know David Cournapeau and Robert Kern is going to hate this.) But if Python can have a custom loader for .pyd files, so can NumPy for it's core DLL. For ctypes we just need to specify a fully qualified path to the DLL, which can be read from a config file or whatever.
This approach does not build a new Python type in compiled code. There are speed disadvantages to this --- especially for the numpy scalars.
> 5. Allow OpenMP pragmas in the core. If arrays are above a certain size, it should switch to multi-threading.
This is an interesting idea.
More information about the NumPy-Discussion