After importing PySide multiprocessing pool hangs on numpy dot
-
I've got this very peculiar hanging happening on my machine when using pytnon multiprocessing Pool with numpy and PySide imported. This is the most entangled bug I have seen in my life so far:) The following code:
@import numpy as np
import PySidedef hang():
import multiprocessing
pool = multiprocessing.Pool(processes = 1)
pool.map(f, [None])def f(ignore):
print('before dot..')
np.dot(np.zeros((128, 1)), np.zeros((1, 32)))
print('after dot.')if name == "main":
hang()
print('success!')@hangs printing only 'before dot..'. But it is supposed to print
@
before dot..
after dot.
success!@so it hangs inside dot function.
There are several magical modifications I can do to prevent hanging:
-
if you decrease shape of arrays going into 'dot' (e.g. from 128 to 127)
-
(!) if you increase shape of arrays going into 'dot' from 128 to 256
-
if you do not use multiprocessing and just run function 'f'
-
if you comment out PySide import which is not used anywhere in the code
Any help is appreciated!
Packages version:
numpy=1.8.1. PySide=1.2.1 or 1.2.2
Python version:
Python 2.7.5 (default, Sep 12 2013, 21:33:34) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
or
Python 2.7.6 (default, Apr 9 2014, 11:48:52) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin
-
-
Is it really numpy.dot or could it also be numpy.zeros?
I am allocating a huge 3d matrix via numpy.zeros and I seem to have a deadlock in some cases there too.