Unverified 提交 bdfaafac authored 作者: Sam Johnson's avatar Sam Johnson 提交者: GitHub

Bugfix: spaces in temp path prevents cudnn init

When initializing theano with cudnn, _try_compile_tmp is eventually run to verify compiling a test program with gcc. This function requests a temporary path for the test program from tempfile.py. Rarely, tempfile.py can return a path that has spaces in it. If this happens, gcc cannot parse it correctly and throws an error. This change prevents the issue by wrapping the temporary path in quotes. For an example case: I was running python through an ssh client which accesses the home directory through a symlink in C:\Program Files\openssh\. Tempfile.py defaulted to the working directory and returned the path including the space in "Program Files", which crashed gcc.
上级 d395439a
......@@ -1782,6 +1782,8 @@ class Compiler(object):
try:
fd, path = tempfile.mkstemp(suffix='.c', prefix=tmp_prefix)
exe_path = path[:-2]
path = "\"" + path + "\""
exe_path = "\"" + exe_path + "\""
try:
# Python3 compatibility: try to cast Py3 strings as Py2 strings
try:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论