Unverified 提交 75e8f999 authored 作者: Ricardo Vieira's avatar Ricardo Vieira 提交者: GitHub

Add `compiler_verbose` config flag (#1520)

* Add compiler_verbose config flag * Add entry in `config.rst` for `compiler_verbose` --------- Co-authored-by: 's avatarJesse Grabowski <jessegrabowski@gmail.com>
上级 801845cc
...@@ -556,6 +556,15 @@ import ``pytensor`` and print the config variable, as in: ...@@ -556,6 +556,15 @@ import ``pytensor`` and print the config variable, as in:
When ``True``, print the rewrites applied to stdout. When ``True``, print the rewrites applied to stdout.
.. attribute:: compiler_verbose
Bool value: either ``True`` or ``False``
Default: ``False``
When ``True``, print detailed information about the compilation of a graph. The type of information printed will
vary depending on the computational backend, and some backends may not provide additional information.
.. attribute:: nocleanup .. attribute:: nocleanup
Bool value: either ``True`` or ``False`` Bool value: either ``True`` or ``False``
......
...@@ -430,6 +430,13 @@ def add_compile_configvars(): ...@@ -430,6 +430,13 @@ def add_compile_configvars():
in_c_key=False, in_c_key=False,
) )
config.add(
"compiler_verbose",
"Print information about compilation steps.",
BoolParam(False),
in_c_key=False,
)
config.add( config.add(
"on_opt_error", "on_opt_error",
( (
......
...@@ -82,6 +82,7 @@ class PyTensorConfigParser: ...@@ -82,6 +82,7 @@ class PyTensorConfigParser:
optimizer: str optimizer: str
optimizer_verbose: bool optimizer_verbose: bool
optimizer_verbose_ignore: str optimizer_verbose_ignore: str
compiler_verbose: bool
on_opt_error: str on_opt_error: str
nocleanup: bool nocleanup: bool
on_unused_input: str on_unused_input: str
......
...@@ -285,10 +285,14 @@ def generate_fallback_impl(op, node=None, storage_map=None, **kwargs): ...@@ -285,10 +285,14 @@ def generate_fallback_impl(op, node=None, storage_map=None, **kwargs):
"""Create a Numba compatible function from a Pytensor `Op`.""" """Create a Numba compatible function from a Pytensor `Op`."""
warnings.warn( warnings.warn(
f"Numba will use object mode to run {op}'s perform method", f"Numba will use object mode to run {op}'s perform method. "
f"Set `pytensor.config.compiler_verbose = True` to see more details.",
UserWarning, UserWarning,
) )
if config.compiler_verbose:
node.dprint(depth=5, print_type=True)
n_outputs = len(node.outputs) n_outputs = len(node.outputs)
if n_outputs > 1: if n_outputs > 1:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论