Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
12e948a5
提交
12e948a5
authored
3月 05, 2013
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1267 from nouiz/march
Fix march on windows
上级
a1a03e58
6e7018b6
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
24 行增加
和
20 行删除
+24
-20
cmodule.py
theano/gof/cmodule.py
+8
-13
compiledir.py
theano/gof/compiledir.py
+0
-3
vm.py
theano/gof/vm.py
+2
-2
windows.py
theano/misc/windows.py
+13
-0
run_tests_in_batch.py
theano/tests/run_tests_in_batch.py
+1
-2
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
12e948a5
...
@@ -1481,12 +1481,10 @@ def gcc_llvm():
...
@@ -1481,12 +1481,10 @@ def gcc_llvm():
"""
"""
if
gcc_llvm
.
is_llvm
is
None
:
if
gcc_llvm
.
is_llvm
is
None
:
pass
pass
dummy_in
=
open
(
os
.
devnull
)
p
=
None
p
=
None
try
:
try
:
p
=
call_subprocess_Popen
([
'g++'
,
'--version'
],
p
=
call_subprocess_Popen
([
'g++'
,
'--version'
],
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stdin
=
dummy_in
.
fileno
(),
stderr
=
subprocess
.
PIPE
)
stderr
=
subprocess
.
PIPE
)
p
.
wait
()
p
.
wait
()
output
=
p
.
stdout
.
read
()
+
p
.
stderr
.
read
()
output
=
p
.
stdout
.
read
()
+
p
.
stderr
.
read
()
...
@@ -1499,7 +1497,6 @@ def gcc_llvm():
...
@@ -1499,7 +1497,6 @@ def gcc_llvm():
# will crash later so supposing it is not llvm is "safe".
# will crash later so supposing it is not llvm is "safe".
output
=
''
output
=
''
del
p
del
p
del
dummy_in
gcc_llvm
.
is_llvm
=
"llvm"
in
output
gcc_llvm
.
is_llvm
=
"llvm"
in
output
return
gcc_llvm
.
is_llvm
return
gcc_llvm
.
is_llvm
gcc_llvm
.
is_llvm
=
None
gcc_llvm
.
is_llvm
=
None
...
@@ -1547,8 +1544,9 @@ class GCC_compiler(object):
...
@@ -1547,8 +1544,9 @@ class GCC_compiler(object):
def
get_lines
(
cmd
,
parse
=
True
):
def
get_lines
(
cmd
,
parse
=
True
):
p
=
call_subprocess_Popen
(
cmd
,
p
=
call_subprocess_Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
s
tdout
=
subprocess
.
PIPE
,
s
hell
=
True
)
shell
=
True
)
p
.
wait
()
p
.
wait
()
stdout
=
p
.
stdout
.
readlines
()
stdout
=
p
.
stdout
.
readlines
()
stderr
=
p
.
stderr
.
readlines
()
stderr
=
p
.
stderr
.
readlines
()
...
@@ -1566,7 +1564,8 @@ class GCC_compiler(object):
...
@@ -1566,7 +1564,8 @@ class GCC_compiler(object):
lines
=
stdout
+
stderr
lines
=
stdout
+
stderr
return
lines
return
lines
native_lines
=
get_lines
(
"g++ -march=native -E -v - </dev/null"
)
# The '-' at the end is needed. Otherwise, g++ do not output enough information.
native_lines
=
get_lines
(
"g++ -march=native -E -v -"
)
_logger
.
info
(
"g++ -march=native selected lines:
%
s"
,
native_lines
)
_logger
.
info
(
"g++ -march=native selected lines:
%
s"
,
native_lines
)
if
len
(
native_lines
)
!=
1
:
if
len
(
native_lines
)
!=
1
:
_logger
.
warn
(
_logger
.
warn
(
...
@@ -1577,7 +1576,7 @@ class GCC_compiler(object):
...
@@ -1577,7 +1576,7 @@ class GCC_compiler(object):
" Theano's mailing list such that we fix this"
" Theano's mailing list such that we fix this"
" problem:
\n
%
s"
,
native_lines
)
" problem:
\n
%
s"
,
native_lines
)
else
:
else
:
default_lines
=
get_lines
(
"g++ -E -v -
</dev/null
"
)
default_lines
=
get_lines
(
"g++ -E -v -"
)
_logger
.
info
(
"g++ default lines:
%
s"
,
default_lines
)
_logger
.
info
(
"g++ default lines:
%
s"
,
default_lines
)
if
len
(
default_lines
)
<
1
:
if
len
(
default_lines
)
<
1
:
_logger
.
warn
(
_logger
.
warn
(
...
@@ -1588,7 +1587,7 @@ class GCC_compiler(object):
...
@@ -1588,7 +1587,7 @@ class GCC_compiler(object):
" function. Can you submit the following lines to"
" function. Can you submit the following lines to"
" Theano's mailing list such that we fix this"
" Theano's mailing list such that we fix this"
" problem:
\n
%
s"
,
" problem:
\n
%
s"
,
get_lines
(
"g++ -E -v -
</dev/null
"
,
parse
=
False
))
get_lines
(
"g++ -E -v -"
,
parse
=
False
))
else
:
else
:
part
=
native_lines
[
0
]
.
split
()
part
=
native_lines
[
0
]
.
split
()
for
line
in
default_lines
:
for
line
in
default_lines
:
...
@@ -1643,7 +1642,6 @@ class GCC_compiler(object):
...
@@ -1643,7 +1642,6 @@ class GCC_compiler(object):
try
:
try
:
fd
,
path
=
tempfile
.
mkstemp
(
suffix
=
'.c'
,
prefix
=
tmp_prefix
)
fd
,
path
=
tempfile
.
mkstemp
(
suffix
=
'.c'
,
prefix
=
tmp_prefix
)
exe_path
=
path
[:
-
2
]
exe_path
=
path
[:
-
2
]
dummy_stdin
=
open
(
os
.
devnull
)
try
:
try
:
os
.
write
(
fd
,
src_code
)
os
.
write
(
fd
,
src_code
)
os
.
close
(
fd
)
os
.
close
(
fd
)
...
@@ -1651,8 +1649,7 @@ class GCC_compiler(object):
...
@@ -1651,8 +1649,7 @@ class GCC_compiler(object):
proc
=
call_subprocess_Popen
(
proc
=
call_subprocess_Popen
(
[
'g++'
,
path
,
'-o'
,
exe_path
]
+
flags
,
[
'g++'
,
path
,
'-o'
,
exe_path
]
+
flags
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdin
=
dummy_stdin
.
fileno
())
proc
.
wait
()
proc
.
wait
()
if
proc
.
returncode
!=
0
:
if
proc
.
returncode
!=
0
:
compilation_ok
=
False
compilation_ok
=
False
...
@@ -1662,14 +1659,12 @@ class GCC_compiler(object):
...
@@ -1662,14 +1659,12 @@ class GCC_compiler(object):
try
:
try
:
proc
=
call_subprocess_Popen
([
exe_path
],
proc
=
call_subprocess_Popen
([
exe_path
],
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdin
=
dummy_stdin
.
fileno
())
proc
.
wait
()
proc
.
wait
()
run_ok
=
(
proc
.
returncode
==
0
)
run_ok
=
(
proc
.
returncode
==
0
)
finally
:
finally
:
os
.
remove
(
exe_path
)
os
.
remove
(
exe_path
)
finally
:
finally
:
del
dummy_stdin
try
:
try
:
if
fd
is
not
None
:
if
fd
is
not
None
:
os
.
close
(
fd
)
os
.
close
(
fd
)
...
...
theano/gof/compiledir.py
浏览文件 @
12e948a5
...
@@ -18,13 +18,11 @@ from theano.misc.windows import call_subprocess_Popen
...
@@ -18,13 +18,11 @@ from theano.misc.windows import call_subprocess_Popen
# Using the dummy file descriptors below is a workaround for a crash
# Using the dummy file descriptors below is a workaround for a crash
# experienced in an unusual Python 2.4.4 Windows environment with the default
# experienced in an unusual Python 2.4.4 Windows environment with the default
# None values.
# None values.
dummy_in
=
open
(
os
.
devnull
)
dummy_err
=
open
(
os
.
devnull
,
'w'
)
dummy_err
=
open
(
os
.
devnull
,
'w'
)
p
=
None
p
=
None
try
:
try
:
p
=
call_subprocess_Popen
([
'g++'
,
'-dumpversion'
],
p
=
call_subprocess_Popen
([
'g++'
,
'-dumpversion'
],
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stdin
=
dummy_in
.
fileno
(),
stderr
=
dummy_err
.
fileno
())
stderr
=
dummy_err
.
fileno
())
p
.
wait
()
p
.
wait
()
gcc_version_str
=
p
.
stdout
.
readline
()
.
strip
()
.
decode
()
gcc_version_str
=
p
.
stdout
.
readline
()
.
strip
()
.
decode
()
...
@@ -32,7 +30,6 @@ except OSError:
...
@@ -32,7 +30,6 @@ except OSError:
# Typically means gcc cannot be found.
# Typically means gcc cannot be found.
gcc_version_str
=
'GCC_NOT_FOUND'
gcc_version_str
=
'GCC_NOT_FOUND'
del
p
del
p
del
dummy_in
del
dummy_err
del
dummy_err
compiledir_format_dict
=
{
"platform"
:
platform
.
platform
(),
compiledir_format_dict
=
{
"platform"
:
platform
.
platform
(),
...
...
theano/gof/vm.py
浏览文件 @
12e948a5
...
@@ -491,13 +491,13 @@ try:
...
@@ -491,13 +491,13 @@ try:
# skip VM.__init__
# skip VM.__init__
except
ImportError
:
except
ImportError
:
pass
pass
except
(
OSError
,
theano
.
gof
.
cmodule
.
MissingGXX
):
except
(
OSError
,
theano
.
gof
.
cmodule
.
MissingGXX
)
,
e
:
# OSError happens when g++ is not installed. In that case, we
# OSError happens when g++ is not installed. In that case, we
# already changed the default linker to something else then CVM.
# already changed the default linker to something else then CVM.
# Currently this is the py linker.
# Currently this is the py linker.
# Here we assert that the default linker is not cvm.
# Here we assert that the default linker is not cvm.
assert
not
[
x
for
x
in
theano
.
configparser
.
_config_var_list
assert
not
[
x
for
x
in
theano
.
configparser
.
_config_var_list
if
x
.
fullname
==
'linker'
][
0
]
.
default
.
startswith
(
'cvm'
)
if
x
.
fullname
==
'linker'
][
0
]
.
default
.
startswith
(
'cvm'
)
,
e
pass
pass
...
...
theano/misc/windows.py
浏览文件 @
12e948a5
...
@@ -21,5 +21,18 @@ def call_subprocess_Popen(command, **params):
...
@@ -21,5 +21,18 @@ def call_subprocess_Popen(command, **params):
# execute "g++" without extensions.
# execute "g++" without extensions.
# (Executing "g++.bat" explicitly would also work.)
# (Executing "g++.bat" explicitly would also work.)
params
[
'shell'
]
=
True
params
[
'shell'
]
=
True
# Using the dummy file descriptors below is a workaround for a
# crash experienced in an unusual Python 2.4.4 Windows environment
# with the default None values.
stdin
=
None
if
"stdin"
not
in
params
:
stdin
=
open
(
os
.
devnull
)
params
[
'stdin'
]
=
stdin
.
fileno
()
try
:
proc
=
subprocess
.
Popen
(
command
,
startupinfo
=
startupinfo
,
**
params
)
proc
=
subprocess
.
Popen
(
command
,
startupinfo
=
startupinfo
,
**
params
)
finally
:
if
stdin
is
not
None
:
del
stdin
return
proc
return
proc
theano/tests/run_tests_in_batch.py
浏览文件 @
12e948a5
...
@@ -276,8 +276,7 @@ def run(stdout, stderr, argv, theano_nose, batch_size, time_profile,
...
@@ -276,8 +276,7 @@ def run(stdout, stderr, argv, theano_nose, batch_size, time_profile,
# test name in display
# test name in display
# (see class 'DisabDocString' in file theano-nose)
# (see class 'DisabDocString' in file theano-nose)
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stdout
=
dummy_out
.
fileno
(),
stdout
=
dummy_out
.
fileno
())
stdin
=
dummy_in
.
fileno
())
# recovering and processing data from pipe
# recovering and processing data from pipe
err
=
proc
.
stderr
.
read
()
err
=
proc
.
stderr
.
read
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论