提交 b92d21d2 authored 作者: Frederic Bastien's avatar Frederic Bastien

fix a bug when gcc segfault when compile the convop with -O3 when the kernel shape is 1,1.

上级 6ff2fca5
...@@ -579,6 +579,14 @@ def std_libs(): ...@@ -579,6 +579,14 @@ def std_libs():
def std_lib_dirs(): def std_lib_dirs():
return std_lib_dirs_and_libs()[1] return std_lib_dirs_and_libs()[1]
p=subprocess.Popen(['gcc','-dumpversion'],stdout=subprocess.PIPE)
p.wait()
gcc_version_str = p.stdout.readline().strip()
del p
def gcc_version():
return gcc_version_str
def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[], lib_dirs=[], libs=[], def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[], lib_dirs=[], libs=[],
preargs=[]): preargs=[]):
""" """
......
...@@ -100,6 +100,21 @@ class ConvOp(Op): ...@@ -100,6 +100,21 @@ class ConvOp(Op):
'imshp_logical', 'kshp_logical', 'kshp_logical_top_aligned'] 'imshp_logical', 'kshp_logical', 'kshp_logical_top_aligned']
"""These attributes uniquely identify the behaviour of this op for given inputs""" """These attributes uniquely identify the behaviour of this op for given inputs"""
def c_compile_args(self):
#when the ksph==(1,1) gcc 4.3.0 segfault during the compilation with -O3.
#This don't happen at -O2
if theano.gof.cmodule.gcc_version() in ['4.3.0'] and self.kshp==(1,1):
return ['-O2']
else: return []
def c_no_compile_args(self):
#when the ksph==(1,1) gcc 4.3.0 segfault during the compilation with -O3.
#This don't happen at -O2
if theano.gof.cmodule.gcc_version() in ['4.3.0'] and self.kshp==(1,1):
return ['-O3']
else: return []
@staticmethod @staticmethod
def getOutputShape(inshp, kshp, (dx,dy)=(1,1), mode='valid'): def getOutputShape(inshp, kshp, (dx,dy)=(1,1), mode='valid'):
""" """
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论