提交 3b914f3b authored 作者: notoraptor's avatar notoraptor

Add boolean Theano flag cmodule.debug to enable DEBUG mode for C code.

上级 e679cd14
...@@ -1058,6 +1058,12 @@ import theano and print the config variable, as in: ...@@ -1058,6 +1058,12 @@ import theano and print the config variable, as in:
reused by Theano. Automatic deletion of those c module 7 days reused by Theano. Automatic deletion of those c module 7 days
after that time. after that time.
.. attribute:: config.cmodule.debug
Bool value, default: ``False``
If True, define a DEBUG macro (if not exists) for any compiled C code.
.. attribute:: config.traceback.limit .. attribute:: config.traceback.limit
Int value, default: 8 Int value, default: 8
......
...@@ -1139,6 +1139,11 @@ AddConfigVar('cmodule.age_thresh_use', ...@@ -1139,6 +1139,11 @@ AddConfigVar('cmodule.age_thresh_use',
IntParam(60 * 60 * 24 * 24, allow_override=False), IntParam(60 * 60 * 24 * 24, allow_override=False),
in_c_key=False) in_c_key=False)
AddConfigVar('cmodule.debug',
"If True, define a DEBUG macro (if not exists) for any compiled C code.",
BoolParam(False),
in_c_key=True)
def default_blas_ldflags(): def default_blas_ldflags():
global numpy global numpy
......
...@@ -910,6 +910,12 @@ class CLinker(link.Linker): ...@@ -910,6 +910,12 @@ class CLinker(link.Linker):
The support code from Variables is added before the support code from Ops.This might contain duplicates. The support code from Variables is added before the support code from Ops.This might contain duplicates.
""" """
ret = [] ret = []
if config.cmodule.debug:
ret.append("""
#ifndef DEBUG
#define DEBUG
#endif
""")
# generic support code # generic support code
for x in [y.type for y in self.variables] + [ for x in [y.type for y in self.variables] + [
y.op for y in self.node_order]: y.op for y in self.node_order]:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论