Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5e10c1f1
提交
5e10c1f1
authored
1月 13, 2012
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #330 from josharian/version-in-compiledir
Make platform-dependent compiledir configurable
上级
e87df287
59153acb
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
51 行增加
和
16 行删除
+51
-16
config.txt
doc/library/config.txt
+15
-3
configparser.py
theano/configparser.py
+14
-3
compiledir.py
theano/gof/compiledir.py
+22
-10
没有找到文件。
doc/library/config.txt
浏览文件 @
5e10c1f1
...
@@ -288,16 +288,28 @@ import theano and print the config variable, as in:
...
@@ -288,16 +288,28 @@ import theano and print the config variable, as in:
Default: On Windows: $LOCALAPPDATA\\Theano if $LOCALAPPDATA is defined,
Default: On Windows: $LOCALAPPDATA\\Theano if $LOCALAPPDATA is defined,
otherwise and on other systems: ~/.theano.
otherwise and on other systems: ~/.theano.
This directory stores the architecture-dependent compilation directories.
This directory stores the platform-dependent compilation directories.
This flag's value cannot be modified during the program execution.
.. attribute:: compiledir_format
Default: "compiledir_%(platform)s-%(processor)s-%(python_version)s"
This is a Python format string that specifies the subdirectory
of ``config.base_compiledir`` in which to store platform-dependent
compiled modules. To see a list of all available substitution keys,
run ``python -c "import theano; print theano.config"``, and look
for compiledir_format.
This flag's value cannot be modified during the program execution.
This flag's value cannot be modified during the program execution.
.. attribute:: compiledir
.. attribute:: compiledir
Default: ``config.base_compiledir``/
<arch-identifier>
Default: ``config.base_compiledir``/
``config.compiledir_format``
This directory stores dynamically-compiled modules for a particular
This directory stores dynamically-compiled modules for a particular
architecture
.
platform
.
This flag's value cannot be modified during the program execution.
This flag's value cannot be modified during the program execution.
...
...
theano/configparser.py
浏览文件 @
5e10c1f1
...
@@ -60,8 +60,16 @@ def config_files_from_theanorc():
...
@@ -60,8 +60,16 @@ def config_files_from_theanorc():
rval
.
append
(
os
.
path
.
expanduser
(
'~/.theanorc.txt'
))
rval
.
append
(
os
.
path
.
expanduser
(
'~/.theanorc.txt'
))
return
rval
return
rval
theano_cfg
=
ConfigParser
.
SafeConfigParser
({
'USER'
:
os
.
getenv
(
"USER"
,
os
.
path
.
split
(
os
.
path
.
expanduser
(
'~'
))[
-
1
])})
theano_cfg
.
read
(
config_files_from_theanorc
())
config_files
=
config_files_from_theanorc
()
theano_cfg
=
ConfigParser
.
SafeConfigParser
({
'USER'
:
os
.
getenv
(
"USER"
,
os
.
path
.
split
(
os
.
path
.
expanduser
(
'~'
))[
-
1
])})
theano_cfg
.
read
(
config_files
)
# Having a raw version of the config around as well enables us to pass
# through config values that contain format strings.
# The time required to parse the config twice is negligible.
theano_raw_cfg
=
ConfigParser
.
RawConfigParser
()
theano_raw_cfg
.
read
(
config_files
)
def
fetch_val_for_key
(
key
):
def
fetch_val_for_key
(
key
):
"""Return the overriding config value for a key.
"""Return the overriding config value for a key.
...
@@ -92,7 +100,10 @@ def fetch_val_for_key(key):
...
@@ -92,7 +100,10 @@ def fetch_val_for_key(key):
else
:
else
:
section
,
option
=
'global'
,
key
section
,
option
=
'global'
,
key
try
:
try
:
return
theano_cfg
.
get
(
section
,
option
)
try
:
return
theano_cfg
.
get
(
section
,
option
)
except
ConfigParser
.
InterpolationError
:
return
theano_raw_cfg
.
get
(
section
,
option
)
except
(
ConfigParser
.
NoOptionError
,
ConfigParser
.
NoSectionError
):
except
(
ConfigParser
.
NoOptionError
,
ConfigParser
.
NoSectionError
):
raise
KeyError
(
key
)
raise
KeyError
(
key
)
...
...
theano/gof/compiledir.py
浏览文件 @
5e10c1f1
...
@@ -4,19 +4,32 @@ import os
...
@@ -4,19 +4,32 @@ import os
import
platform
import
platform
import
re
import
re
import
sys
import
sys
import
textwrap
import
theano
import
theano
from
theano.configparser
import
config
,
AddConfigVar
,
ConfigParam
,
StrParam
from
theano.configparser
import
config
,
AddConfigVar
,
ConfigParam
,
StrParam
compiledir_format_dict
=
{
"platform"
:
platform
.
platform
(),
"processor"
:
platform
.
processor
(),
"python_version"
:
platform
.
python_version
(),
"theano_version"
:
theano
.
__version__
,
}
compiledir_format_keys
=
", "
.
join
(
compiledir_format_dict
.
keys
())
default_compiledir_format
=
"compiledir_
%(platform)
s-
%(processor)
s-
%(python_version)
s"
AddConfigVar
(
"compiledir_format"
,
textwrap
.
fill
(
textwrap
.
dedent
(
"""
\
Format string for platform-dependent compiled
module subdirectory (relative to base_compiledir).
Available keys:
%
s. Defaults to
%
r.
"""
%
(
compiledir_format_keys
,
default_compiledir_format
))),
StrParam
(
default_compiledir_format
,
allow_override
=
False
))
def
default_compiledirname
():
def
default_compiledirname
():
platform_id
=
'-'
.
join
([
formatted
=
config
.
compiledir_format
%
compiledir_format_dict
platform
.
platform
(),
safe
=
re
.
sub
(
"[
\
(
\
)
\
s,]+"
,
"_"
,
formatted
)
platform
.
processor
(),
return
safe
platform
.
python_version
(),
theano
.
__version__
])
platform_id
=
re
.
sub
(
"[
\
(
\
)
\
s,]+"
,
"_"
,
platform_id
)
return
'compiledir_'
+
platform_id
def
filter_compiledir
(
path
):
def
filter_compiledir
(
path
):
...
@@ -78,12 +91,11 @@ else:
...
@@ -78,12 +91,11 @@ else:
AddConfigVar
(
'base_compiledir'
,
AddConfigVar
(
'base_compiledir'
,
"
arch-independent cache
directory for compiled modules"
,
"
platform-independent root
directory for compiled modules"
,
StrParam
(
default_base_compiledir
,
allow_override
=
False
))
StrParam
(
default_base_compiledir
,
allow_override
=
False
))
AddConfigVar
(
'compiledir'
,
AddConfigVar
(
'compiledir'
,
"
arch
-dependent cache directory for compiled modules"
,
"
platform
-dependent cache directory for compiled modules"
,
ConfigParam
(
ConfigParam
(
os
.
path
.
join
(
os
.
path
.
join
(
os
.
path
.
expanduser
(
config
.
base_compiledir
),
os
.
path
.
expanduser
(
config
.
base_compiledir
),
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论