提交 11a2b8e8 authored 作者: Frederic's avatar Frederic

Use the logger and pep8 fix.

上级 0a85b16f
...@@ -1506,14 +1506,16 @@ class GCC_compiler(object): ...@@ -1506,14 +1506,16 @@ class GCC_compiler(object):
for f in cxxflags: for f in cxxflags:
#If the user give an -march=X parameter, don't add one ourself #If the user give an -march=X parameter, don't add one ourself
if ((f.startswith("--march=") or f.startswith("-march="))): if ((f.startswith("--march=") or f.startswith("-march="))):
print ("WARNING: your Theano flags `gcc.cxxflags` specify" _logget.warn(
" an `-march=X` flags that isn't `-march=native`") "WARNING: your Theano flags `gcc.cxxflags` specify"
print (" It is better to let Theano/g++ find it" " an `-march=X` flags that isn't `-march=native`.\n"
" It is better to let Theano/g++ find it"
" automatically, but we don't do it now") " automatically, but we don't do it now")
detect_march = False detect_march = False
if detect_march: if detect_march:
GCC_compiler.march_flags = [] GCC_compiler.march_flags = []
def get_lines(cmd): def get_lines(cmd):
p = call_subprocess_Popen(cmd, p = call_subprocess_Popen(cmd,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
...@@ -1531,7 +1533,13 @@ class GCC_compiler(object): ...@@ -1531,7 +1533,13 @@ class GCC_compiler(object):
native_lines = get_lines("g++ -march=native -E -v - </dev/null") native_lines = get_lines("g++ -march=native -E -v - </dev/null")
_logger.info("g++ -march=native selected lines: %s", native_lines) _logger.info("g++ -march=native selected lines: %s", native_lines)
if len(native_lines) != 1: if len(native_lines) != 1:
_logger.warn("OPTIMIZATION WARNING: Theano was not able to find the g++ parameter that tune the compilation to your specific CPU. This can slow down the execution of Theano function. Can you submit the following lines to Theano's mailing list such that we fix this problem:\n %s", native_lines) _logger.warn(
"OPTIMIZATION WARNING: Theano was not able to find the"
" g++ parameter that tune the compilation to your specific"
" CPU. This can slow down the execution of Theano"
" function. Can you submit the following lines to"
" Theano's mailing list such that we fix this"
" problem:\n %s", native_lines)
else: else:
default_lines = get_lines("g++ -E -v - </dev/null") default_lines = get_lines("g++ -E -v - </dev/null")
_logger.info("g++ default lines: %s", default_lines) _logger.info("g++ default lines: %s", default_lines)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论