Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b1984de0
提交
b1984de0
authored
2月 20, 2013
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1228 from lamblin/default_blas_flags
Test default blas flags before using them
上级
116ad0f3
2c26e54e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
56 行增加
和
3 行删除
+56
-3
cmodule.py
theano/gof/cmodule.py
+43
-0
blas.py
theano/tensor/blas.py
+13
-3
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
b1984de0
...
...
@@ -1483,6 +1483,49 @@ class GCC_compiler(object):
cxxflags
.
append
(
"-D NPY_ARRAY_F_CONTIGUOUS=NPY_F_CONTIGUOUS"
)
return
cxxflags
@staticmethod
def
try_flags
(
flag_list
):
'''
Try to compile a dummy file with these flags.
Returns True if compilation was successful, False if there
were errors.
'''
if
not
theano
.
config
.
cxx
:
return
False
rval
=
True
try
:
code
=
"""
int main(int argc, char** argv)
{
return 0;
}
"""
fd
,
path
=
tempfile
.
mkstemp
(
suffix
=
'.c'
,
prefix
=
'try_flags_'
)
dummy_stdin
=
open
(
os
.
devnull
)
try
:
os
.
write
(
fd
,
code
)
os
.
close
(
fd
)
fd
=
None
proc
=
call_subprocess_Popen
([
'g++'
,
path
]
+
flag_list
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stdin
=
dummy_stdin
.
fileno
())
proc
.
wait
()
if
proc
.
returncode
!=
0
:
rval
=
False
finally
:
del
dummy_stdin
try
:
if
fd
is
not
None
:
os
.
close
(
fd
)
finally
:
os
.
remove
(
path
)
except
OSError
,
e
:
rval
=
False
return
rval
@staticmethod
def
compile_str
(
module_name
,
src_code
,
location
=
None
,
include_dirs
=
None
,
lib_dirs
=
None
,
libs
=
None
,
...
...
theano/tensor/blas.py
浏览文件 @
b1984de0
...
...
@@ -138,6 +138,7 @@ from theano.gof import (utils, Op, view_roots, DestroyHandler,
InconsistencyError
,
toolbox
,
SequenceDB
,
EquilibriumOptimizer
,
Apply
,
ReplacementDidntRemovedError
)
from
theano.gof.cmodule
import
GCC_compiler
from
theano.printing
import
pprint
,
FunctionPrinter
,
debugprint
from
theano.compile.mode
import
optdb
from
theano.gof.python25
import
all
,
any
...
...
@@ -373,9 +374,8 @@ def default_blas_ldflags():
#if numpy was linked with library that are not installed, we
#can't reuse them.
if
all
(
not
os
.
path
.
exists
(
dir
)
for
dir
in
blas_info
[
'library_dirs'
]):
return
"-lblas"
return
' '
.
join
(
if
any
(
os
.
path
.
exists
(
dir
)
for
dir
in
blas_info
[
'library_dirs'
]):
return
' '
.
join
(
#TODO: the Gemm op below should separate the
# -L and -l arguments into the two callbacks
# that CLinker uses for that stuff. for now,
...
...
@@ -386,7 +386,17 @@ def default_blas_ldflags():
[])
# ['-I%s' % l for l in blas_info['include_dirs']])
except
KeyError
:
pass
# Even if we could not detect what was used for numpy, or if these
# libraries are not found, most Linux systems have a libblas.so
# readily available. We try to see if that's the case, rather
# than disable blas.
if
GCC_compiler
.
try_flags
([
"-lblas"
]):
return
"-lblas"
else
:
return
""
AddConfigVar
(
'blas.ldflags'
,
"lib[s] to include for [Fortran] level-3 blas implementation"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论