提交 bba7fda1 authored 作者: Frederic's avatar Frederic

Correctly detect if we can reuse -lblas. We need to check with the compilation…

Correctly detect if we can reuse -lblas. We need to check with the compilation argument to be used and execute the program. Otherwise we won't detect some type of error
上级 6465f22c
...@@ -129,6 +129,7 @@ import copy ...@@ -129,6 +129,7 @@ import copy
import logging import logging
import os import os
import sys import sys
import textwrap
import time import time
import warnings import warnings
...@@ -312,8 +313,31 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in ...@@ -312,8 +313,31 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
# Even if we could not detect what was used for numpy, or if these # 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 # libraries are not found, most Linux systems have a libblas.so
# 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. # than disable blas. To test it correctly, we must load a program.
if GCC_compiler.try_flags(["-lblas"]): # Otherwise, there could be problem in the LD_LIBRARY_PATH.
test_code = textwrap.dedent("""\
extern "C" float sdot_(int*, float*, int*, float*, int*);
int main(int argc, char** argv)
{
int Nx = 5;
int Sx = 1;
float x[5] = {0, 1, 2, 3, 4};
float r = sdot_(&Nx, x, &Sx, x, &Sx);
if ((r - 30.f) > 1e-6 || (r - 30.f) < -1e-6)
{
return -1;
}
return 0;
}
""")
flags = ['-lblas']
flags.extend('-L'.join(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[0] and res[1]:
return "-lblas" return "-lblas"
else: else:
return "" return ""
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论