我想在使用自定义numba-fied函数快速运行的IPython集群上运行计算。我尝试使用sync_imports
对象的dview
方法同步导入。问题是引擎似乎没有正确加载numba,而numpy导入得很好......这是一个简短的“最小”代码,指出了问题:
from IPython.parallel import Client
rc = Client()
dview = rc[:]
print 'before import'
with dview.sync_imports():
import numpy
import numba
print 'no deadlock'
当我运行此代码时,在numpy导入后发生了一种死锁,过了一段时间我得到了这个错误:
before import importing numpy on engine(s) importing numba on engine(s) Traceback (most recent call last): File "./ipcltest.py", line 12, in import numba File "/c5/shared/Python/2.7.4-shared/lib/python2.7/contextlib.py", line 24, in __exit__ self.gen.next() File "/c5/shared/Python/2.7.4-shared/lib/python2.7/site-packages/IPython/parallel/client/view.py", line 496, in sync_imports r.get() File "/c5/shared/Python/2.7.4-shared/lib/python2.7/site-packages/IPython/parallel/client/asyncresult.py", line 119, in get self.wait(timeout) File "/c5/shared/Python/2.7.4-shared/lib/python2.7/site-packages/IPython/parallel/client/asyncresult.py", line 142, in wait self._ready = self._client.wait(self.msg_ids, timeout) File "/c5/shared/Python/2.7.4-shared/lib/python2.7/site-packages/IPython/parallel/client/client.py", line 1063, in wait self.spin() File "/c5/shared/Python/2.7.4-shared/lib/python2.7/site-packages/IPython/parallel/client/client.py", line 1013, in spin self._flush_results(self._mux_socket) File "/c5/shared/Python/2.7.4-shared/lib/python2.7/site-packages/IPython/parallel/client/client.py", line 821, in _flush_results raise Exception("Unhandled message type: %s" % msg_type) Exception: Unhandled message type: apply_request ./ipcltest.py 1.20s user 0.40s system 0% cpu 25:29.11 total
有没有人知道导致这种行为的原因是什么?