Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
034c9c37
提交
034c9c37
authored
1月 20, 2016
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix default blas flag detection by reworking try_blas_flag.
上级
62eed15f
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
19 行增加
和
11 行删除
+19
-11
blas.py
theano/tensor/blas.py
+19
-11
没有找到文件。
theano/tensor/blas.py
浏览文件 @
034c9c37
...
@@ -289,8 +289,9 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
...
@@ -289,8 +289,9 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
flags
+=
[
'-l
%
s'
%
l
for
l
in
[
"mkl_core"
,
flags
+=
[
'-l
%
s'
%
l
for
l
in
[
"mkl_core"
,
"mkl_intel_thread"
,
"mkl_intel_thread"
,
"mkl_rt"
]]
"mkl_rt"
]]
if
try_blas_flag
(
flags
):
res
=
try_blas_flag
(
flags
)
return
' '
.
join
(
flags
)
if
res
:
return
res
ret
=
(
ret
=
(
# TODO: the Gemm op below should separate the
# TODO: the Gemm op below should separate the
...
@@ -301,8 +302,10 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
...
@@ -301,8 +302,10 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
[
'-L
%
s'
%
l
for
l
in
blas_info
.
get
(
'library_dirs'
,
[])]
+
[
'-L
%
s'
%
l
for
l
in
blas_info
.
get
(
'library_dirs'
,
[])]
+
[
'-l
%
s'
%
l
for
l
in
blas_info
.
get
(
'libraries'
,
[])]
+
[
'-l
%
s'
%
l
for
l
in
blas_info
.
get
(
'libraries'
,
[])]
+
blas_info
.
get
(
'extra_link_args'
,
[]))
blas_info
.
get
(
'extra_link_args'
,
[]))
if
try_blas_flag
(
ret
):
res
=
try_blas_flag
(
ret
)
return
' '
.
join
(
ret
)
if
res
:
return
res
# Try to add the anaconda lib directory to runtime loading of lib.
# Try to add the anaconda lib directory to runtime loading of lib.
# This fix some case with Anaconda 2.3 on Linux.
# This fix some case with Anaconda 2.3 on Linux.
# Newer Anaconda still have this problem but only have
# Newer Anaconda still have this problem but only have
...
@@ -311,8 +314,9 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
...
@@ -311,8 +314,9 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
and
"linux"
in
sys
.
platform
):
and
"linux"
in
sys
.
platform
):
lib_path
=
os
.
path
.
join
(
sys
.
prefix
,
'lib'
)
lib_path
=
os
.
path
.
join
(
sys
.
prefix
,
'lib'
)
ret
.
append
(
'-Wl,-rpath,'
+
lib_path
)
ret
.
append
(
'-Wl,-rpath,'
+
lib_path
)
if
try_blas_flag
(
ret
):
res
=
try_blas_flag
(
ret
)
return
' '
.
join
(
ret
)
if
res
:
return
res
except
KeyError
:
except
KeyError
:
pass
pass
...
@@ -322,9 +326,7 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
...
@@ -322,9 +326,7 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
# readily available. We try to see if that's the case, rather
# readily available. We try to see if that's the case, rather
# than disable blas. To test it correctly, we must load a program.
# than disable blas. To test it correctly, we must load a program.
# Otherwise, there could be problem in the LD_LIBRARY_PATH.
# Otherwise, there could be problem in the LD_LIBRARY_PATH.
ret
=
try_blas_flag
([
'-lblas'
])
return
try_blas_flag
([
'-lblas'
])
if
ret
:
return
' '
.
join
(
ret
)
def
try_blas_flag
(
flags
):
def
try_blas_flag
(
flags
):
...
@@ -344,15 +346,21 @@ def try_blas_flag(flags):
...
@@ -344,15 +346,21 @@ def try_blas_flag(flags):
return 0;
return 0;
}
}
"""
)
"""
)
flags
.
extend
(
'-L'
+
d
for
d
in
theano
.
gof
.
cmodule
.
std_lib_dirs
())
res
=
GCC_compiler
.
try_compile_tmp
(
res
=
GCC_compiler
.
try_compile_tmp
(
test_code
,
tmp_prefix
=
'try_blas_'
,
test_code
,
tmp_prefix
=
'try_blas_'
,
flags
=
flags
,
try_run
=
True
)
flags
=
flags
,
try_run
=
True
)
# res[0]: shows successful compilation
# res[0]: shows successful compilation
# res[1]: shows successful execution
# res[1]: shows successful execution
if
res
and
res
[
0
]
and
res
[
1
]:
if
res
and
res
[
0
]
and
res
[
1
]:
return
flags
return
' '
.
join
(
flags
)
else
:
else
:
# Retry adding '-L' flags which may be required
flags
=
flags
+
[
'-L'
+
d
for
d
in
theano
.
gof
.
cmodule
.
std_lib_dirs
()]
res
=
GCC_compiler
.
try_compile_tmp
(
test_code
,
tmp_prefix
=
'try_blas_'
,
flags
=
flags
,
try_run
=
True
)
if
res
and
res
[
0
]
and
res
[
1
]:
return
' '
.
join
(
flags
)
return
""
return
""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论