[NumPy-Tickets] [NumPy] #2201: numpy.linalg and multiprocessing crash

NumPy Trac numpy-tickets@scipy....
Tue Aug 14 02:25:26 CDT 2012

#2201: numpy.linalg and multiprocessing crash
 Reporter:  agchang       |       Owner:  pv         
     Type:  defect        |      Status:  new        
 Priority:  high          |   Milestone:  Unscheduled
Component:  numpy.linalg  |     Version:  1.6.1      
 Keywords:                |  
 There seems to be an issue with numpy.linalg being called in unison with
 python's multiprocessing module. When invoking a numpy.linalg method from
 within a subprocess, e.g., through a worker pool and map() function, the
 program hangs and ignores all interrupt signals.

 The code provided below will demonstrate the case:

 import numpy as np
 import multiprocessing as mp

 def foo(x):
     print np.linalg.inv([[2,3],[2,2]]) #this causes the crash
     #print np.dot([[1,2],[3,4]],[[1,2],[3,4]]) # this works fine

 def test():
     print "running..."
     print np.__version__
     print mp.__version__
     vals = [1,2,3,4]
     #pool = mp.Pool(1) #This has an issue
     #pool = mp.Pool(mp.cpu_count()) #this has an issue
     pool.map(foo, vals)

 if __name__ == "__main__":
     #foo(1) #this works fine


 By hang I mean the program becomes unresponsive and does not respond to

 I took a look using pdb and it seems that it hangs after the call
 __waiter__.acquire() in threading.py(the python system module) so I
 suspect some sort of deadlock?

 multiprocessing.__version__ is 0.70a1
 numpy.__version__ is 1.6.1

 Some potentially related packages?

 ii  libblas3gf     1.2.20110419-2 Basic Linear Algebra Reference
 ii  liblapack3gf   3.3.1-1        library of linear algebra routines 3 -
 ii  python         2.7.3-0ubuntu2 interactive high-level object-oriented
 ii  python-numpy   1:1.6.1-6ubunt Numerical Python adds a fast array

 My kernel version is(uname -a):

 Linux agc 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012
 x86_64 x86_64 x86_64 GNU/Linux

 Let me know for any additional information.


Ticket URL: <http://projects.scipy.org/numpy/ticket/2201>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list