Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
11e7b1fe
提交
11e7b1fe
authored
1月 11, 2012
作者:
Josh Bleecher Snyder
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make platform-dependent compiledir configurable
上级
724a2569
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
36 行增加
和
13 行删除
+36
-13
configparser.py
theano/configparser.py
+14
-3
compiledir.py
theano/gof/compiledir.py
+22
-10
没有找到文件。
theano/configparser.py
浏览文件 @
11e7b1fe
...
...
@@ -60,8 +60,16 @@ def config_files_from_theanorc():
rval
.
append
(
os
.
path
.
expanduser
(
'~/.theanorc.txt'
))
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
):
"""Return the overriding config value for a key.
...
...
@@ -92,7 +100,10 @@ def fetch_val_for_key(key):
else
:
section
,
option
=
'global'
,
key
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
):
raise
KeyError
(
key
)
...
...
theano/gof/compiledir.py
浏览文件 @
11e7b1fe
...
...
@@ -4,19 +4,32 @@ import os
import
platform
import
re
import
sys
import
textwrap
import
theano
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
():
platform_id
=
'-'
.
join
([
platform
.
platform
(),
platform
.
processor
(),
platform
.
python_version
(),
theano
.
__version__
])
platform_id
=
re
.
sub
(
"[
\
(
\
)
\
s,]+"
,
"_"
,
platform_id
)
return
'compiledir_'
+
platform_id
formatted
=
config
.
compiledir_format
%
compiledir_format_dict
safe
=
re
.
sub
(
"[
\
(
\
)
\
s,]+"
,
"_"
,
formatted
)
return
safe
def
filter_compiledir
(
path
):
...
...
@@ -78,12 +91,11 @@ else:
AddConfigVar
(
'base_compiledir'
,
"
arch-independent cache
directory for compiled modules"
,
"
platform-independent root
directory for compiled modules"
,
StrParam
(
default_base_compiledir
,
allow_override
=
False
))
AddConfigVar
(
'compiledir'
,
"
arch
-dependent cache directory for compiled modules"
,
"
platform
-dependent cache directory for compiled modules"
,
ConfigParam
(
os
.
path
.
join
(
os
.
path
.
expanduser
(
config
.
base_compiledir
),
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论