Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5896afd8
提交
5896afd8
authored
1月 13, 2015
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2240 from nouiz/platform
Change default platform to something that don't change when it isn't nee...
上级
e2e0be8a
bc7420de
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
100 行增加
和
1 行删除
+100
-1
compiledir.py
theano/gof/compiledir.py
+80
-1
test_compiledir.py
theano/gof/tests/test_compiledir.py
+20
-0
没有找到文件。
theano/gof/compiledir.py
浏览文件 @
5896afd8
...
...
@@ -64,8 +64,87 @@ compiledir_format_dict = {
"gxx_version"
:
gcc_version_str
.
replace
(
" "
,
"_"
),
"hostname"
:
socket
.
gethostname
(),
}
def
short_platform
(
r
=
None
,
p
=
None
):
"""Return a safe shorter version of platform.platform().
The old default Theano compiledir used platform.platform in
it. This use the platform.version() as a substring. This is too
specific as it contain the full kernel number and package
version. This cause the compiledir to change each time there is a
new linux kernel update. This function remove the part of platform
that are too precise.
If we have something else then expected, we do nothing. So this
should be safe on other OS.
Some example if we use platform.platform() direction. On the same
OS, with just some kernel updates.
compiledir_Linux-2.6.32-504.el6.x86_64-x86_64-with-redhat-6.6-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.29.2.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.23.3.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.20.3.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.17.1.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.11.2.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-431.el6.x86_64-x86_64-with-redhat-6.5-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.23.2.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.6.2.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.6.1.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.2.1.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6-64
compiledir_Linux-2.6.32-358.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-279.14.1.el6.x86_64-x86_64-with-redhat-6.4-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-279.14.1.el6.x86_64-x86_64-with-redhat-6.3-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-279.5.2.el6.x86_64-x86_64-with-redhat-6.3-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-220.13.1.el6.x86_64-x86_64-with-redhat-6.3-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-220.13.1.el6.x86_64-x86_64-with-redhat-6.2-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-220.7.1.el6.x86_64-x86_64-with-redhat-6.2-Santiago-x86_64-2.6.6
compiledir_Linux-2.6.32-220.4.1.el6.x86_64-x86_64-with-redhat-6.2-Santiago-x86_64-2.6.6
We suppose the version are ``X.Y[.*]-(digit)*(anything)*``. We
keep ``X.Y`` and don't keep less important digit in the part
before ``-`` and we remove the leading digit after the first
``-``.
If the information don't fit that pattern, we do not modify
platform.
"""
if
r
is
None
:
r
=
platform
.
release
()
if
p
is
None
:
p
=
platform
.
platform
()
sp
=
r
.
split
(
'-'
)
if
len
(
sp
)
<
2
:
return
p
# For the split before the first -, we remove all learning digit:
kernel_version
=
sp
[
0
]
.
split
(
'.'
)
if
len
(
kernel_version
)
<=
2
:
# kernel version should always have at least 3 number.
# If not, it use another semantic, so don't change it.
return
p
sp
[
0
]
=
'.'
.
join
(
kernel_version
[:
2
])
# For the split after the first -, we remove leading non-digit value.
rest
=
sp
[
1
]
.
split
(
'.'
)
while
len
(
rest
):
if
rest
[
0
]
.
isdigit
():
del
rest
[
0
]
else
:
break
sp
[
1
]
=
'.'
.
join
(
rest
)
# For sp[2:], we don't change anything.
sr
=
'-'
.
join
(
sp
)
p
=
p
.
replace
(
r
,
sr
)
return
p
compiledir_format_dict
[
'short_platform'
]
=
short_platform
()
compiledir_format_keys
=
", "
.
join
(
sorted
(
compiledir_format_dict
.
keys
()))
default_compiledir_format
=
(
"compiledir_
%(platform)
s-
%(processor)
s-"
default_compiledir_format
=
(
"compiledir_
%(
short_
platform)
s-
%(processor)
s-"
"
%(python_version)
s-
%(python_bitwidth)
s"
)
AddConfigVar
(
"compiledir_format"
,
...
...
theano/gof/tests/test_compiledir.py
0 → 100644
浏览文件 @
5896afd8
from
theano.gof.compiledir
import
short_platform
def
test_short_platform
():
for
r
,
p
,
a
in
[
# (release, platform, answer)
(
'3.2.0-70-generic'
,
'Linux-3.2.0-70-generic-x86_64-with-debian-wheezy-sid'
,
"Linux-3.2--generic-x86_64-with-debian-wheezy-sid"
),
(
'3.2.0-70.1-generic'
,
'Linux-3.2.0-70.1-generic-x86_64-with-debian-wheezy-sid'
,
"Linux-3.2--generic-x86_64-with-debian-wheezy-sid"
),
(
'3.2.0-70.1.2-generic'
,
'Linux-3.2.0-70.1.2-generic-x86_64-with-debian-wheezy-sid'
,
"Linux-3.2--generic-x86_64-with-debian-wheezy-sid"
),
(
'2.6.35.14-106.fc14.x86_64'
,
'Linux-2.6.35.14-106.fc14.x86_64-x86_64-with-fedora-14-Laughlin'
,
'Linux-2.6-fc14.x86_64-x86_64-with-fedora-14-Laughlin'
),
]:
o
=
short_platform
(
r
,
p
)
assert
o
==
a
,
(
o
,
a
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论