[NumPy-Tickets] [NumPy] #2131: PyArray_TakeFrom does not release GIL

NumPy Trac numpy-tickets@scipy....
Mon Jun 11 19:38:17 CDT 2012

#2131: PyArray_TakeFrom does not release GIL
 Reporter:  rainwoodman  |       Owner:  somebody    
     Type:  defect       |      Status:  needs_review
 Priority:  normal       |   Milestone:  Unscheduled 
Component:  numpy.lib    |     Version:  1.6.1       
 Keywords:               |  
Changes (by rainwoodman):

  * status:  new => needs_review


 I've added a simple patch that releases the GIL if no MASKNA is set.

 The fasttake function in array_types.src.c shall avoid setting PyErr.
 Because the only error it returns is the out of bound error with a return-
 value of 1, it is easy to simply catch the return-value and emit the
 python exception in item_selection.c.

 A brief test was done, picking up 200,000,000 elements from a 200,000,000
 'f8' array, with mode='wrap'.

 Without the patch, it took ~15 seconds with 12 threads(~20 seconds doing
 it in serial).
 With the patch it took 2 seconds; faster than yet on the same order with
 multiprocessing(~4 seconds).

Ticket URL: <http://projects.scipy.org/numpy/ticket/2131#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list