提交 1619970c authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Use that mechanism to check if "-lblas" works

before returning it as default value
上级 3d31dd81
...@@ -138,6 +138,7 @@ from theano.gof import (utils, Op, view_roots, DestroyHandler, ...@@ -138,6 +138,7 @@ from theano.gof import (utils, Op, view_roots, DestroyHandler,
InconsistencyError, toolbox, SequenceDB, InconsistencyError, toolbox, SequenceDB,
EquilibriumOptimizer, Apply, EquilibriumOptimizer, Apply,
ReplacementDidntRemovedError) ReplacementDidntRemovedError)
from theano.gof.cmodule import GCC_compiler
from theano.printing import pprint, FunctionPrinter, debugprint from theano.printing import pprint, FunctionPrinter, debugprint
from theano.compile.mode import optdb from theano.compile.mode import optdb
from theano.gof.python25 import all, any from theano.gof.python25 import all, any
...@@ -373,9 +374,8 @@ def default_blas_ldflags(): ...@@ -373,9 +374,8 @@ def default_blas_ldflags():
#if numpy was linked with library that are not installed, we #if numpy was linked with library that are not installed, we
#can't reuse them. #can't reuse them.
if all(not os.path.exists(dir) for dir in blas_info['library_dirs']): if any(os.path.exists(dir) for dir in blas_info['library_dirs']):
return "-lblas" return ' '.join(
return ' '.join(
#TODO: the Gemm op below should separate the #TODO: the Gemm op below should separate the
# -L and -l arguments into the two callbacks # -L and -l arguments into the two callbacks
# that CLinker uses for that stuff. for now, # that CLinker uses for that stuff. for now,
...@@ -386,7 +386,17 @@ def default_blas_ldflags(): ...@@ -386,7 +386,17 @@ def default_blas_ldflags():
[]) [])
# ['-I%s' % l for l in blas_info['include_dirs']]) # ['-I%s' % l for l in blas_info['include_dirs']])
except KeyError: 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" return "-lblas"
else:
return ""
AddConfigVar('blas.ldflags', AddConfigVar('blas.ldflags',
"lib[s] to include for [Fortran] level-3 blas implementation", "lib[s] to include for [Fortran] level-3 blas implementation",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论