提交 141fa114 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Creation of the compilation directory should now be more robust to parallel execution

上级 e1d7f89a
...@@ -32,7 +32,13 @@ def set_compiledir(path=None): ...@@ -32,7 +32,13 @@ def set_compiledir(path=None):
path = os.path.join(os.getenv('HOME'), '.theano', 'compiledir_'+platform_id) path = os.path.join(os.getenv('HOME'), '.theano', 'compiledir_'+platform_id)
if not os.access(path, os.R_OK | os.W_OK): if not os.access(path, os.R_OK | os.W_OK):
os.makedirs(path, 0770) #read-write-execute for this user only try:
os.makedirs(path, 0770) #read-write-execute for this user only
except OSError, e:
# Maybe another parallel execution of theano was trying to create
# the same directory at the same time.
if e.errno != EEXIST:
raise
# PROBLEM: sometimes the first approach based on os.system('touch') # PROBLEM: sometimes the first approach based on os.system('touch')
# returned -1 for an unknown reason; the alternate approach here worked # returned -1 for an unknown reason; the alternate approach here worked
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论