Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6ce3aa78
提交
6ce3aa78
authored
1月 19, 2016
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3884 from abergeron/fix_mac_blas
Fix blas detection on mac.
上级
ae444d3d
0c108883
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
25 行增加
和
28 行删除
+25
-28
blas.py
theano/tensor/blas.py
+25
-28
没有找到文件。
theano/tensor/blas.py
浏览文件 @
6ce3aa78
...
@@ -272,10 +272,11 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
...
@@ -272,10 +272,11 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
"mk2_rt"
]])
"mk2_rt"
]])
# Anaconda
# Anaconda
if
"Anaconda"
in
sys
.
version
and
sys
.
platform
==
"win32"
:
if
"Anaconda"
in
sys
.
version
and
sys
.
platform
==
"win32"
:
# If the "mkl-service" conda package (available through Python
# If the "mkl-service" conda package (available
# package "mkl") is installed and importable, then the libraries
# through Python package "mkl") is installed and
# (installed by conda package "mkl-rt") are actually available.
# importable, then the libraries (installed by conda
# Using "conda install mkl" will install both, as well as
# package "mkl-rt") are actually available. Using
# "conda install mkl" will install both, as well as
# optimized versions of numpy and scipy.
# optimized versions of numpy and scipy.
try
:
try
:
import
mkl
# noqa
import
mkl
# noqa
...
@@ -291,28 +292,24 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
...
@@ -291,28 +292,24 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
if
try_blas_flag
(
flags
):
if
try_blas_flag
(
flags
):
return
' '
.
join
(
flags
)
return
' '
.
join
(
flags
)
# If numpy was linked with library that are not installed or
ret
=
(
# the dev version of the package is not currently available, we
# TODO: the Gemm op below should separate the
# can't reuse them.
# -L and -l arguments into the two callbacks
if
any
(
os
.
path
.
exists
(
dir
)
for
dir
in
blas_info
[
'library_dirs'
]):
# that CLinker uses for that stuff. for now,
ret
=
(
# we just pass the whole ldflags as the -l
# TODO: the Gemm op below should separate the
# options part.
# -L and -l arguments into the two callbacks
[
'-L
%
s'
%
l
for
l
in
blas_info
.
get
(
'library_dirs'
,
[])]
+
# that CLinker uses for that stuff. for now,
[
'-l
%
s'
%
l
for
l
in
blas_info
.
get
(
'libraries'
,
[])]
+
# we just pass the whole ldflags as the -l
blas_info
.
get
(
'extra_link_args'
,
[]))
# options part.
if
try_blas_flag
(
ret
):
[
'-L
%
s'
%
l
for
l
in
blas_info
[
'library_dirs'
]]
+
return
' '
.
join
(
ret
)
[
'-l
%
s'
%
l
for
l
in
blas_info
[
'libraries'
]]
+
# Try to add the anaconda lib directory to runtime loading of lib.
[])
# This fix some case with Anaconda 2.3 on Linux.
if
"Anaconda"
in
sys
.
version
and
"linux"
in
sys
.
platform
:
lib_path
=
os
.
path
.
join
(
sys
.
prefix
,
'lib'
)
ret
.
append
(
'-Wl,-rpath,'
+
lib_path
)
if
try_blas_flag
(
ret
):
if
try_blas_flag
(
ret
):
return
' '
.
join
(
ret
)
return
' '
.
join
(
ret
)
# Try to add the anaconda lib directory to runtime loading of lib.
# This fix some case with Anaconda 2.3 on Linux.
if
"Anaconda"
in
sys
.
version
and
"linux"
in
sys
.
platform
:
lib_path
=
os
.
path
.
join
(
sys
.
prefix
,
'lib'
)
ret
.
append
(
'-Wl,-rpath,'
+
lib_path
)
if
try_blas_flag
(
ret
):
return
' '
.
join
(
ret
)
except
KeyError
:
except
KeyError
:
pass
pass
...
@@ -327,15 +324,15 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
...
@@ -327,15 +324,15 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
def
try_blas_flag
(
flags
):
def
try_blas_flag
(
flags
):
test_code
=
textwrap
.
dedent
(
"""
\
test_code
=
textwrap
.
dedent
(
"""
\
extern "C"
float sdot_(int*, float*, int*, float
*, int*);
extern "C"
double ddot_(int*, double*, int*, double
*, int*);
int main(int argc, char** argv)
int main(int argc, char** argv)
{
{
int Nx = 5;
int Nx = 5;
int Sx = 1;
int Sx = 1;
float
x[5] = {0, 1, 2, 3, 4};
double
x[5] = {0, 1, 2, 3, 4};
float r = s
dot_(&Nx, x, &Sx, x, &Sx);
double r = d
dot_(&Nx, x, &Sx, x, &Sx);
if ((r - 30.
f) > 1e-6 || (r - 30.f
) < -1e-6)
if ((r - 30.
) > 1e-6 || (r - 30.
) < -1e-6)
{
{
return -1;
return -1;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论