提交 ec9b867d authored 作者: slefrancois's avatar slefrancois 提交者: Frederic

use compile_args in Compiler._try_compile_tmp

上级 a2b1a9e2
...@@ -1711,8 +1711,8 @@ class Compiler(object): ...@@ -1711,8 +1711,8 @@ class Compiler(object):
""" """
@staticmethod @classmethod
def _try_compile_tmp(src_code, tmp_prefix='', flags=(), def _try_compile_tmp(cls, src_code, tmp_prefix='', flags=(),
try_run=False, output=False, compiler=None): try_run=False, output=False, compiler=None):
""" """
Try to compile (and run) a test program. Try to compile (and run) a test program.
...@@ -1730,8 +1730,9 @@ class Compiler(object): ...@@ -1730,8 +1730,9 @@ class Compiler(object):
""" """
if not compiler: if not compiler:
return False return False
flags = list(flags) flags = list(flags)
# Get compile arguments from compiler method
args = cls.compile_args()
compilation_ok = True compilation_ok = True
run_ok = False run_ok = False
out, err = None, None out, err = None, None
...@@ -1748,7 +1749,7 @@ class Compiler(object): ...@@ -1748,7 +1749,7 @@ class Compiler(object):
os.close(fd) os.close(fd)
fd = None fd = None
out, err, p_ret = output_subprocess_Popen( out, err, p_ret = output_subprocess_Popen(
[compiler, path, '-o', exe_path] + flags) [compiler] + args + [path, '-o', exe_path] + flags)
if p_ret != 0: if p_ret != 0:
compilation_ok = False compilation_ok = False
elif try_run: elif try_run:
...@@ -1781,8 +1782,8 @@ class Compiler(object): ...@@ -1781,8 +1782,8 @@ class Compiler(object):
else: else:
return (compilation_ok, run_ok, out, err) return (compilation_ok, run_ok, out, err)
@staticmethod @classmethod
def _try_flags(flag_list, preambule="", body="", def _try_flags(cls, flag_list, preambule="", body="",
try_run=False, output=False, compiler=None): try_run=False, output=False, compiler=None):
""" """
Try to compile a dummy file with these flags. Try to compile a dummy file with these flags.
...@@ -1802,7 +1803,7 @@ class Compiler(object): ...@@ -1802,7 +1803,7 @@ class Compiler(object):
return 0; return 0;
} }
""" % locals()) """ % locals())
return Compiler._try_compile_tmp(code, tmp_prefix='try_flags_', return cls._try_compile_tmp(code, tmp_prefix='try_flags_',
flags=flag_list, try_run=try_run, flags=flag_list, try_run=try_run,
output=output, compiler=compiler) output=output, compiler=compiler)
...@@ -2158,17 +2159,17 @@ class GCC_compiler(Compiler): ...@@ -2158,17 +2159,17 @@ class GCC_compiler(Compiler):
return cxxflags return cxxflags
@staticmethod @classmethod
def try_compile_tmp(src_code, tmp_prefix='', flags=(), def try_compile_tmp(cls, src_code, tmp_prefix='', flags=(),
try_run=False, output=False): try_run=False, output=False):
return Compiler._try_compile_tmp(src_code, tmp_prefix, flags, return cls._try_compile_tmp(src_code, tmp_prefix, flags,
try_run, output, try_run, output,
theano.config.cxx) theano.config.cxx)
@staticmethod @classmethod
def try_flags(flag_list, preambule="", body="", def try_flags(cls, flag_list, preambule="", body="",
try_run=False, output=False): try_run=False, output=False):
return Compiler._try_flags(flag_list, preambule, body, try_run, output, return cls._try_flags(flag_list, preambule, body, try_run, output,
theano.config.cxx) theano.config.cxx)
@staticmethod @staticmethod
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论