Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/library/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,15 @@ import ``pytensor`` and print the config variable, as in:

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

Bool value: either ``True`` or ``False``
Expand Down
7 changes: 7 additions & 0 deletions pytensor/configdefaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,13 @@ def add_compile_configvars():
in_c_key=False,
)

config.add(
"compiler_verbose",
"Print information about compilation steps.",
BoolParam(False),
in_c_key=False,
)

config.add(
"on_opt_error",
(
Expand Down
1 change: 1 addition & 0 deletions pytensor/configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class PyTensorConfigParser:
optimizer: str
optimizer_verbose: bool
optimizer_verbose_ignore: str
compiler_verbose: bool
on_opt_error: str
nocleanup: bool
on_unused_input: str
Expand Down
6 changes: 5 additions & 1 deletion pytensor/link/numba/dispatch/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,14 @@ def generate_fallback_impl(op, node=None, storage_map=None, **kwargs):
"""Create a Numba compatible function from a Pytensor `Op`."""

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,
)

if config.compiler_verbose:
node.dprint(depth=5, print_type=True)

n_outputs = len(node.outputs)

if n_outputs > 1:
Expand Down