Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c08a6f31
提交
c08a6f31
authored
12月 02, 2011
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #246 from delallea/win_home
Changed default compiledir under Windows
上级
7984c45b
73575d81
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
62 行增加
和
37 行删除
+62
-37
pipeline.txt
doc/extending/pipeline.txt
+3
-2
config.txt
doc/library/config.txt
+3
-8
configdefaults.py
theano/configdefaults.py
+29
-16
compiledir.py
theano/gof/compiledir.py
+27
-11
没有找到文件。
doc/extending/pipeline.txt
浏览文件 @
c08a6f31
...
@@ -100,8 +100,9 @@ case if ``borrow`` was True, the thunk would be allowed to reuse (or
...
@@ -100,8 +100,9 @@ case if ``borrow`` was True, the thunk would be allowed to reuse (or
.. note::
.. note::
Compiled libraries are stored within a specific compilation directory,
Compiled libraries are stored within a specific compilation directory,
which by default is set to ``$HOME/.theano/compiledir_xxx``, where
which by default is set to ``$HOME/.theano/compiledir_xxx``, where
``xxx`` identifies the platform. It may be manually set to a different
``xxx`` identifies the platform (under Windows the default location
location either by setting :attr:`config.compiledir` or
is instead ``$LOCALAPPDATA\Theano\compiledir_xxx``). It may be manually set
to a different location either by setting :attr:`config.compiledir` or
:attr:`config.base_compiledir`, either within your Python script or by
:attr:`config.base_compiledir`, either within your Python script or by
using one of the configuration mechanisms described in :mod:`config`.
using one of the configuration mechanisms described in :mod:`config`.
...
...
doc/library/config.txt
浏览文件 @
c08a6f31
...
@@ -273,15 +273,10 @@ import theano and print the config variable, as in:
...
@@ -273,15 +273,10 @@ import theano and print the config variable, as in:
This flag's value cannot be modified during the program execution.
This flag's value cannot be modified during the program execution.
.. attribute:: home
Default: env-variable $HOME
This is used to compute the compiledir and base_compiledir attributes
.. attribute:: base_compiledir
.. attribute:: base_compiledir
Default: $HOME/.theano
Default: On Windows: $LOCALAPPDATA\\Theano if $LOCALAPPDATA is defined,
otherwise and on other systems: ~/.theano.
This directory stores the architecture-dependent compilation directories.
This directory stores the architecture-dependent compilation directories.
...
@@ -289,7 +284,7 @@ import theano and print the config variable, as in:
...
@@ -289,7 +284,7 @@ import theano and print the config variable, as in:
.. attribute:: compiledir
.. attribute:: compiledir
Default:
$HOME/.theano
/<arch-identifier>
Default:
``config.base_compiledir``
/<arch-identifier>
This directory stores dynamically-compiled modules for a particular
This directory stores dynamically-compiled modules for a particular
architecture.
architecture.
...
...
theano/configdefaults.py
浏览文件 @
c08a6f31
import
os
import
os
import
subprocess
import
logging
import
logging
import
subprocess
import
sys
from
theano.configparser
import
(
AddConfigVar
,
BoolParam
,
ConfigParam
,
EnumStr
,
IntParam
,
FloatParam
,
StrParam
,
TheanoConfigParser
)
from
theano.configparser
import
TheanoConfigParser
,
AddConfigVar
,
EnumStr
,
StrParam
,
IntParam
,
FloatParam
,
BoolParam
_logger
=
logging
.
getLogger
(
'theano.configdefaults'
)
_logger
=
logging
.
getLogger
(
'theano.configdefaults'
)
...
@@ -118,29 +122,38 @@ AddConfigVar('on_opt_error',
...
@@ -118,29 +122,38 @@ AddConfigVar('on_opt_error',
EnumStr
(
'warn'
,
'raise'
),
EnumStr
(
'warn'
,
'raise'
),
in_c_key
=
False
)
in_c_key
=
False
)
def
get_home_dir
():
home
=
os
.
getenv
(
'HOME'
)
def
safe_no_home
(
home
):
if
home
is
None
:
"""
# This expanduser usually works on Windows (see discussion on
Make sure the user is not attempting to use `config.home`.
# theano-users, July 13 2010).
home
=
os
.
path
.
expanduser
(
'~'
)
This config option was removed in Thenao 0.5 since it was redundant with
if
home
==
'~'
:
`config.base_compiledir`. This filter function ensures people who were
# This might happen when expanduser fails. Although the cause of
setting the location of their compilation directory through `config.home`
# failure is a mystery, it has been seen on some Windows system.
switch to `config.basecompiledir` instead, by raising an error when
home
=
os
.
getenv
(
'USERPROFILE'
)
`config.home` is used.
assert
home
is
not
None
"""
return
home
if
home
:
raise
RuntimeError
(
'The `config.home` option has been removed and should not be '
'used anymore. Please set the `config.base_compiledir` option '
'instead (for instance to:
%
s)'
%
os
.
path
.
join
(
home
,
'.theano'
))
return
True
AddConfigVar
(
'home'
,
AddConfigVar
(
'home'
,
"
User home directory
"
,
"
This config option was removed in 0.5: do not use it!
"
,
StrParam
(
get_home_dir
()
),
ConfigParam
(
''
,
allow_override
=
False
,
filter
=
safe_no_home
),
in_c_key
=
False
)
in_c_key
=
False
)
AddConfigVar
(
'nocleanup'
,
AddConfigVar
(
'nocleanup'
,
"Suppress the deletion of code files that did not compile cleanly"
,
"Suppress the deletion of code files that did not compile cleanly"
,
BoolParam
(
False
),
BoolParam
(
False
),
in_c_key
=
False
)
in_c_key
=
False
)
# This flag is used when we import Theano to initialize global variables.
# This flag is used when we import Theano to initialize global variables.
# So changing it after import will not modify these global variables.
# So changing it after import will not modify these global variables.
# This could be done differently... but for now we simply prevent it from being
# This could be done differently... but for now we simply prevent it from being
...
...
theano/gof/compiledir.py
浏览文件 @
c08a6f31
import
cPickle
import
cPickle
import
errno
import
errno
import
os
import
os
...
@@ -51,19 +50,36 @@ def filter_compiledir(path):
...
@@ -51,19 +50,36 @@ def filter_compiledir(path):
return
path
return
path
# TODO Using the local user profile on Windows is currently disabled as it
def
get_home_dir
():
# is not documented yet, and may break some existing code. It will be enabled
"""
# in a future code update.
Return location of the user's home directory.
if
False
and
sys
.
platform
==
'win32'
:
"""
# On Windows we should not write temporary files to a directory
home
=
os
.
getenv
(
'HOME'
)
# that is part of the roaming part of the user profile. Instead
if
home
is
None
:
# we use the local part of the user profile.
# This expanduser usually works on Windows (see discussion on
basecompiledir
=
os
.
path
.
join
(
os
.
environ
[
'LOCALAPPDATA'
],
'theano'
)
# theano-users, July 13 2010).
home
=
os
.
path
.
expanduser
(
'~'
)
if
home
==
'~'
:
# This might happen when expanduser fails. Although the cause of
# failure is a mystery, it has been seen on some Windows system.
home
=
os
.
getenv
(
'USERPROFILE'
)
assert
home
is
not
None
return
home
# On Windows we should avoid writing temporary files to a directory that is
# part of the roaming part of the user profile. Instead we use the local part
# of the user profile, when available.
if
sys
.
platform
==
'win32'
and
os
.
getenv
(
'LOCALAPPDATA'
)
is
not
None
:
default_base_compiledir
=
os
.
path
.
join
(
os
.
getenv
(
'LOCALAPPDATA'
),
'Theano'
)
else
:
else
:
basecompiledir
=
os
.
path
.
join
(
config
.
home
,
'.theano'
)
default_base_compiledir
=
os
.
path
.
join
(
get_home_dir
(),
'.theano'
)
AddConfigVar
(
'base_compiledir'
,
AddConfigVar
(
'base_compiledir'
,
"arch-independent cache directory for compiled modules"
,
"arch-independent cache directory for compiled modules"
,
StrParam
(
basecompiledir
,
allow_override
=
False
))
StrParam
(
default_base_compiledir
,
allow_override
=
False
))
AddConfigVar
(
'compiledir'
,
AddConfigVar
(
'compiledir'
,
"arch-dependent cache directory for compiled modules"
,
"arch-dependent cache directory for compiled modules"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论