-
Notifications
You must be signed in to change notification settings - Fork 0
Add debug logging for threading and parallelization dec… #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…isions Adds debug logging across Rust and Python components to help diagnose threading behavior and parallelization decisions. Includes logging for: - Rust threading decisions in getenv_use_multiple_threads() - PassManager parallel execution choices and process counts - SABRE layout trial count configuration - parallel_map execution paths and results Co-Authored with the help of: Claude
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds debug logging across Python and Rust components to help diagnose threading and parallelization decisions.
- Python: Injected
logger.debug
statements inshould_run_in_parallel
,parallel_map
, SABRE trial count, and PassManager execution paths. - Rust: Emits threading decision to stderr when
QISKIT_DEBUG_THREADING
is set.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
qiskit/utils/parallel.py | Added logging import, logger setup, and debug statements around parallel decisions and execution. |
qiskit/transpiler/preset_passmanagers/builtin_plugins.py | Added debug logging in _get_trial_count for SABRE threading trials. |
qiskit/passmanager/passmanager.py | Added debug logs in callback_func for serial vs parallel PassManager runs. |
crates/accelerate/src/lib.rs | Added Rust debug printing under QISKIT_DEBUG_THREADING environment variable. |
Comments suppressed due to low confidence (1)
qiskit/utils/parallel.py:197
- The environment variable QISKIT_IN_PARALLEL is only reset in the KeyboardInterrupt branch, so other exceptions leave it set to TRUE. Consider moving the reset into a finally block to ensure it's always restored.
os.environ["QISKIT_IN_PARALLEL"] = "FALSE"
@@ -239,6 +244,9 @@ def callback_func(**kwargs): | |||
del callback | |||
del kwargs | |||
|
|||
logger.debug("PassManager running %d programs in parallel with %d processes", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The serial execution branch assigns to out
but lacks a return, so execution always falls through to the parallel path. Add a return statement inside the if-block to avoid unintended parallel runs.
Copilot uses AI. Check for mistakes.
|
||
// Log threading decision if debug logging is enabled | ||
if env::var("QISKIT_DEBUG_THREADING").is_ok() { | ||
eprintln!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using eprintln!
for debug output is inconsistent with typical Rust logging practices. Consider using the log
crate to emit debug-level messages and integrate with existing logging infrastructure.
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
…isions
Adds debug logging across Rust and Python components to help diagnose threading behavior and parallelization decisions. Includes logging for:
Co-Authored with the help of: Claude
Summary
Details and comments