Hi all, PyGEOS (https://github.com/caspervdw/pygeos) is an experimental package implementing a set of numpy ufuncs to provide vectorized geometry functionality (wrapping the C++ GEOS library).
The way it does this is by implementing a Python extension type (pygeos.Geometry) that wraps an actual GEOSGeometry object by storing a pointer to it in the PyObject struct of the extension type. This way, we can store those objects in an object dtype array in numpy, but still access the pointer in the ufunc inner loop without needing the python interpreter. The single threaded performance of the ufuncs with the approach above is very good. There doesn't seem to be an overhead of using the object array approach. However, as far as I can find in the docs, the GIL is only released in ufuncs for non-object dtypes. So the question here is: is there a way to let numpy release the GIL in such a case nonetheless? Although the array holds python objects, the ufunc inner loop only accesses a static attribute of the object struct, not needing any explicit Python interaction. Best, Joris
_______________________________________________ NumPy-Discussion mailing list [email protected] https://mail.python.org/mailman/listinfo/numpy-discussion
