[Numpy-discussion] degree to which numpy releases threads

Anne Archibald peridot.faceted@gmail....
Sat Apr 7 15:54:58 CDT 2007


On 07/04/07, Fernando Perez <fperez.net@gmail.com> wrote:

> You are correct.  If g,h in the OP's description satisfy:
>
> a) they are bloody expensive
>
> b) they release the GIL internally via the proper C API calls, which
> means they are promising not to modify any shared python objects
>
> the pure python threads approach could help *somewhat*.

I feel silly. Some (many?) numpy functions satisfy both criteria (dot,
for example, when using BLAS, definitely allows threads and can be
bloody expensive), but the OP is hardly likely to be using giant slow
numpy functions and asking this question.

How thorough is numpy's NPY_BEGIN_ALLOW_THREADS coverage? How about
f2py-generated code? It should be fairly easy for f2py to tell when a
hunk of FORTRAN might modify a shared python object (never?), and this
would cover not only much of scipy but much user code as well.

Anne


More information about the Numpy-discussion mailing list