Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c416c5eb
提交
c416c5eb
authored
11月 11, 2014
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2242 from cocu/allow_cxx_flag_full_path
allow cxx flag to be full path to compiler
上级
95d3add9
14334878
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
24 行增加
和
13 行删除
+24
-13
configdefaults.py
theano/configdefaults.py
+4
-4
cmodule.py
theano/gof/cmodule.py
+19
-8
compiledir.py
theano/gof/compiledir.py
+1
-1
没有找到文件。
theano/configdefaults.py
浏览文件 @
c416c5eb
...
...
@@ -131,22 +131,22 @@ AddConfigVar('mode',
'FAST_COMPILE'
,
'PROFILE_MODE'
,
'DEBUG_MODE'
),
in_c_key
=
False
)
enum
=
EnumStr
(
"g++"
,
"
"
)
param
=
StrParam
(
"g++
"
)
# Test whether or not g++ is present: disable C code if it is not.
try
:
rc
=
call_subprocess_Popen
([
'g++'
,
'-v'
])
except
OSError
:
enum
=
EnumStr
(
""
)
param
=
StrParam
(
""
)
rc
=
1
AddConfigVar
(
'cxx'
,
"The C++ compiler to use. Currently only g++ is"
" supported, but supporting additional compilers should not be "
"too difficult. "
"If it is empty, no C++ code is compiled."
,
enu
m
,
para
m
,
in_c_key
=
False
)
del
enu
m
del
para
m
if
rc
==
0
and
config
.
cxx
!=
""
:
# Keep the default linker the same as the one for the mode FAST_RUN
...
...
theano/gof/cmodule.py
浏览文件 @
c416c5eb
...
...
@@ -1522,7 +1522,7 @@ def gcc_llvm():
"""
if
gcc_llvm
.
is_llvm
is
None
:
try
:
p_out
=
output_subprocess_Popen
([
'g++'
,
'--version'
])
p_out
=
output_subprocess_Popen
([
theano
.
config
.
cxx
,
'--version'
])
output
=
p_out
[
0
]
+
p_out
[
1
]
except
OSError
:
# Typically means g++ cannot be found.
...
...
@@ -1544,7 +1544,7 @@ class GCC_compiler(object):
@staticmethod
def
version_str
():
return
"g++
"
+
gcc_version_str
return
theano
.
config
.
cxx
+
"
"
+
gcc_version_str
@staticmethod
def
compile_args
():
...
...
@@ -1572,6 +1572,17 @@ class GCC_compiler(object):
GCC_compiler
.
march_flags
=
[]
break
if
not
"g++"
in
theano
.
config
.
cxx
:
_logger
.
warn
(
"OPTIMIZATION WARNING: your Theano flag `cxx` seems not to be"
" the g++ compiler. So we disable the compiler optimization"
" specific to g++ that tell to compile for a specific CPU."
" At worst, this could cause slow down.
\n
"
" You can add yourself those parameters to the compiler"
" via the Theano flag `gcc.cxxflags`."
)
detect_march
=
False
if
detect_march
:
GCC_compiler
.
march_flags
=
[]
...
...
@@ -1611,7 +1622,7 @@ class GCC_compiler(object):
# The '-' at the end is needed. Otherwise, g++ do not output
# enough information.
native_lines
=
get_lines
(
"
g++ -march=native -E -v -"
)
native_lines
=
get_lines
(
"
%
s -march=native -E -v -"
%
theano
.
config
.
cxx
)
if
native_lines
is
None
:
_logger
.
info
(
"Call to 'g++ -march=native' failed,"
"not setting -march flag"
)
...
...
@@ -1625,7 +1636,7 @@ class GCC_compiler(object):
if
len
(
native_lines
)
==
0
:
# That means we did not select the right lines, so
# we have to report all the lines instead
reported_lines
=
get_lines
(
"
g++ -march=native -E -v -"
,
reported_lines
=
get_lines
(
"
%
s -march=native -E -v -"
%
theano
.
config
.
cxx
,
parse
=
False
)
else
:
reported_lines
=
native_lines
...
...
@@ -1638,7 +1649,7 @@ class GCC_compiler(object):
" problem:
\n
%
s"
,
reported_lines
)
else
:
default_lines
=
get_lines
(
"
g++ -E -v -"
)
default_lines
=
get_lines
(
"
%
s -E -v -"
%
theano
.
config
.
cxx
)
_logger
.
info
(
"g++ default lines:
%
s"
,
default_lines
)
if
len
(
default_lines
)
<
1
:
_logger
.
warn
(
...
...
@@ -1649,7 +1660,7 @@ class GCC_compiler(object):
" functions. Please submit the following lines to"
" Theano's mailing list so that we can fix this"
" problem:
\n
%
s"
,
get_lines
(
"
g++ -E -v -"
,
parse
=
False
))
get_lines
(
"
%
s -E -v -"
%
theano
.
config
.
cxx
,
parse
=
False
))
else
:
# Some options are actually given as "-option value",
# we want to treat them as only one token when comparing
...
...
@@ -1821,7 +1832,7 @@ class GCC_compiler(object):
os
.
close
(
fd
)
fd
=
None
out
,
err
,
p_ret
=
output_subprocess_Popen
(
[
'g++'
,
path
,
'-o'
,
exe_path
]
+
flags
)
[
theano
.
config
.
cxx
,
path
,
'-o'
,
exe_path
]
+
flags
)
if
p_ret
!=
0
:
compilation_ok
=
False
elif
try_run
:
...
...
@@ -1947,7 +1958,7 @@ class GCC_compiler(object):
(
module_name
,
get_lib_extension
()))
_logger
.
debug
(
'Generating shared lib
%
s'
,
lib_filename
)
cmd
=
[
'g++'
,
get_gcc_shared_library_arg
(),
'-g'
]
cmd
=
[
theano
.
config
.
cxx
,
get_gcc_shared_library_arg
(),
'-g'
]
if
config
.
cmodule
.
remove_gxx_opt
:
cmd
.
extend
(
p
for
p
in
preargs
if
not
p
.
startswith
(
'-O'
))
...
...
theano/gof/compiledir.py
浏览文件 @
c416c5eb
...
...
@@ -22,7 +22,7 @@ from theano.misc.windows import output_subprocess_Popen
_logger
=
logging
.
getLogger
(
"theano.gof.compiledir"
)
try
:
p_out
=
output_subprocess_Popen
([
'g++'
,
'-dumpversion'
])
p_out
=
output_subprocess_Popen
([
theano
.
config
.
cxx
,
'-dumpversion'
])
gcc_version_str
=
p_out
[
0
]
.
strip
()
.
decode
()
except
OSError
:
# Typically means gcc cannot be found.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论