[Numpy-discussion] NumPy nogil API

Pauli Virtanen pav at iki.fi
Sun Oct 30 17:01:27 EDT 2011


30.10.2011 21:48, mark florisson kirjoitti:
> First, I'd like to report a bug. It seems ndarray does not implement
> tp_traverse or tp_clear, so if you have a reference cycle in an
> ndarray with dtype object none of those objects will ever be
> collected.

Indeed, this is missing. http://projects.scipy.org/numpy/ticket/1003

If I recall correctly, there was something painful in implementing this 
for Numpy arrays, though...

> Secondly, please bear with me, I'm not a NumPy expert, but would it be
> possible to have NumPy export an API that can be called without the
> GIL? In the upcoming Cython release 0.16 (soon to be released) we will
> have what is called typed memoryviews [1], which allow you to obtain a
> typed view on any PEP 3118 buffer, and it allows you to do a lot more
> things without the GIL. e.g. it allows you to pass these views around,
> transpose them, slice them (in the same way as in NumPy but slightly
> more restricted, it doesn't support masks and such), index them etc
> without the GIL.

The closest thing to making this to happen is the work made on porting 
Numpy to IronPython. Basically, a major part of that involved ripping 
the innards of Numpy out to a more reusable C library. It's been in a 
merge-limbo for some time now, however.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list