[SciPy-user] Multithreading cookbook entry

Anand Patil anand.prabhakar.patil@gmail....
Thu Feb 21 10:58:26 CST 2008


On Thu, Feb 21, 2008 at 8:30 AM, Anne Archibald
<peridot.faceted@gmail.com> wrote:

> It would be useful to go through the code looking at which ones
>  do and don't release the GIL, and put it in their docstrings; it might
>  be possible to make more release the GIL. It's a pretty safe bet that
>  the ufuncs do; I would guess that the linear algebra functions do too.
>  Probably not much else.

I second that suggestion. In fact I'd be willing to help out if it's a
tedious but simple job.

>  If an extension uses ctypes, whether it releases the GIL is up to
>  ctypes. I would guess that it doesn't, since ctypes knows nothing
>  about the C function, but I have never actually used ctypes.

Makes sense. Does anyone know about f2py extensions with 'cf2py
threadsafe' set? From the f2py user's guide, the threadsafe option
will

Use Py_BEGIN_ALLOW_THREADS .. Py_END_ALLOW_THREADS block around the
call to Fortran/C function.

Is that sufficien to release the GIL? What if the functions have callbacks??

Anand


More information about the SciPy-user mailing list