[英]Race condition with scipy.weave.inline
Recently I've begun to receive SyntaxError
s when running parallel neural-network simulations using brian2
. 最近,当使用
brian2
运行并行神经网络模拟时,我开始收到SyntaxError
。 These are being raised by calls to scipy.weave.inline
when it tries to evaluate lines of code in a cache file. 当它尝试评估缓存文件中的代码
scipy.weave.inline
,通过调用scipy.weave.inline
会引发这些问题。
The full description of the problem and my guess at its cause is here . 问题的完整描述和原因的我的猜测在这里 。
And here is a link to a related question I asked earlier, with a full stacktrace for one of the errors. 这是我之前问过的一个相关问题的链接,其中包含完整的堆栈跟踪信息(其中一个错误)。 My answer to that question provides just a temporary solution.
我对这个问题的回答只是一个临时解决方案。 (Syntax errors are re-introduced as soon as a new set of parallel runs is executed.)
(一旦执行了一组新的并行运行,便会重新引入语法错误。)
Is there an easy way for me to avoid this race condition? 有什么简单的方法可以避免这种比赛情况吗?
This appears to be a known bug in scipy
: See this and this discussion on github
. 这似乎是一个已知的错误
scipy
:见本与此有关的讨论github
。 Some workarounds are suggested in these discussions: 这些讨论中提出了一些解决方法:
1) Execute a single run of the script -- so that the cache file is filled -- and then execute the other runs in parallel. 1)执行一次脚本运行-以便填充缓存文件-然后并行执行其他运行。 The parallel runs will not try to re-fill the cache.
并行运行不会尝试重新填充缓存。
2) Make a symbolic link from /tmp
to ~/.python27_compiled
. 2)创建从
/tmp
到~/.python27_compiled
的符号链接。 (I'm not sure why this would work.) (我不确定为什么会这样。)
3) Use cython
instead. 3)改用
cython
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.