Skip to content

Conversation

@mrossinek
Copy link
Member

@mrossinek mrossinek commented Nov 18, 2025

This refactors the parallelization of the unequal time commutator bound computation.
The parallelization is still done using a multiprocessing.Pool with a user-configurable number of processes and maximum computation timeout.

However, prior to this PR the code was processing the circuit layer-by-layer, where the bound computation of all noise terms appearing in a single layer have to complete before moving on to the next one. This can hinder performance when only a few of these terms take a long time to compute during which time the remanining processes end up idling.

This PR updates the implementation to submit the computation of all noise term bounds across all layers as asynchronous tasks to be processed in parallel. This avoids the bottleneck above as pending tasks can continue to be processed even when long running ones block single resources.


This allowed a tets computation of the forward bounds on a mirrored time evolution using 20 Trotter steps on a 40 qubit kicked Ising Hamiltonian to complete entirely within 55 minutes on 96 parallel processes while the old implementation timed out after processing 54 of the 80 layers.

Old bounds New bounds
image image

Before this PR can be merged, I still need to address the following:

  • update the process indicator (it now indicates the process of task submission with is almost instant but then remains silent throughout the actual computation)
  • (opt.) add some unittesting of the timeout behavior
  • add a release note
  • revert the changes to the existing end-to-end test

@coveralls
Copy link

coveralls commented Nov 18, 2025

Pull Request Test Coverage Report for Build 19540738427

Details

  • 34 of 41 (82.93%) changed or added relevant lines in 2 files are covered.
  • 52 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-6.2%) to 74.401%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_addon_slc/bounds/forward.py 0 1 0.0%
qiskit_addon_slc/bounds/commutator_bounds.py 34 40 85.0%
Files with Coverage Reduction New Missed Lines %
qiskit_addon_slc/bounds/backward.py 13 60.61%
qiskit_addon_slc/bounds/forward.py 39 32.0%
Totals Coverage Status
Change from base Build 19343778199: -6.2%
Covered Lines: 590
Relevant Lines: 793

💛 - Coveralls

Copy link
Contributor

@aeddins-ibm aeddins-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see the speedup in those lightcone plots at the top of the PR!

Commenting even though this is WIP. I'm suspicious of the use of nonlocal seemingly to share write access to an object across processes, but OTOH it's apparently working so far...

@mrossinek
Copy link
Member Author

For reerence purposes, this is what the logging output now looks like:

2025-11-19 17:04:42,906 INFO base_tasks Pass: GroupGatesIntoBoxes - 7.89261 (ms)
2025-11-19 17:04:42,907 INFO base_tasks Pass: GroupMeasIntoBoxes - 0.39744 (ms)
2025-11-19 17:04:42,909 INFO base_tasks Pass: AddTerminalRightDressedBoxes - 2.25949 (ms)
2025-11-19 17:04:42,916 INFO base_tasks Pass: AddInjectNoise - 6.94704 (ms)
2025-11-19 17:04:42,935 INFO forward Evolving Pauli error terms forwards through the circuit.
2025-11-19 17:04:42,935 INFO forward Modelling errors as though they happen *after* each noise layer.
2025-11-19 17:04:42,935 INFO remove_measure Removing ANY Measure operations from the provided circuit!
2025-11-19 17:04:42,954 INFO commutator_bounds Starting to spawn bound computation tasks
2025-11-19 17:04:42,955 INFO circuit_iter Noisy box 'm7'
2025-11-19 17:04:43,011 INFO circuit_iter Noisy box 'm6'
2025-11-19 17:04:43,081 INFO circuit_iter Noisy box 'm5'
2025-11-19 17:04:43,106 INFO circuit_iter Noisy box 'm4'
2025-11-19 17:04:43,138 INFO circuit_iter Noisy box 'm3'
2025-11-19 17:04:43,160 INFO circuit_iter Noisy box 'm2'
2025-11-19 17:04:43,191 INFO circuit_iter Noisy box 'm1'
2025-11-19 17:04:43,212 INFO circuit_iter Noisy box 'm0'
2025-11-19 17:04:43,244 INFO commutator_bounds Total number of spawned tasks: 4632
2025-11-19 17:04:43,759 INFO commutator_bounds Progress: ..........                                         [970/4632] 20.9%
2025-11-19 17:04:43,776 INFO commutator_bounds Progress: ............                                       [1179/4632] 25.5%
2025-11-19 17:04:44,408 INFO commutator_bounds Progress: ...............................................    [4330/4632] 93.5%
2025-11-19 17:04:44,503 INFO commutator_bounds Progress: .................................................  [4577/4632] 98.8%
2025-11-19 17:04:44,518 INFO commutator_bounds Progress: .................................................. [4630/4632] 100.0%
2025-11-19 17:04:44,519 INFO commutator_bounds Progress: .................................................. [4632/4632] 100.0%
2025-11-19 17:04:44,519 INFO commutator_bounds Successfully completed [4632/4632] tasks!
2025-11-19 17:04:44,798 INFO speed_limit Tighting bounds using information propagation speed limits
2025-11-19 17:04:44,798 INFO speed_limit Modelling errors as though they happen *after* each noise layer.
2025-11-19 17:04:44,895 INFO remove_measure Removing ANY Measure operations from the provided circuit!
2025-11-19 17:04:44,904 INFO circuit_iter Noisy box 'm7'
2025-11-19 17:04:44,910 INFO circuit_iter Noisy box 'm6'
2025-11-19 17:04:44,921 INFO circuit_iter Noisy box 'm5'
2025-11-19 17:04:44,926 INFO circuit_iter Noisy box 'm4'
2025-11-19 17:04:44,937 INFO circuit_iter Noisy box 'm3'
2025-11-19 17:04:44,942 INFO circuit_iter Noisy box 'm2'
2025-11-19 17:04:44,952 INFO circuit_iter Noisy box 'm1'
2025-11-19 17:04:44,957 INFO circuit_iter Noisy box 'm0'
2025-11-19 17:04:44,968 INFO backward Evolving Pauli error terms backwards through the circuit.
2025-11-19 17:04:44,968 INFO backward Modelling errors as though they happen *after* each noise layer.
2025-11-19 17:04:44,968 INFO remove_measure Removing ANY Measure operations from the provided circuit!
2025-11-19 17:04:44,985 INFO commutator_bounds Starting to spawn bound computation tasks
2025-11-19 17:04:45,027 INFO circuit_iter Noisy box 'm0'
2025-11-19 17:04:45,083 INFO circuit_iter Noisy box 'm1'
2025-11-19 17:04:45,273 INFO circuit_iter Noisy box 'm2'
2025-11-19 17:04:45,350 INFO circuit_iter Noisy box 'm3'
2025-11-19 17:04:45,427 INFO circuit_iter Noisy box 'm4'
2025-11-19 17:04:45,462 INFO circuit_iter Noisy box 'm5'
2025-11-19 17:04:45,512 INFO circuit_iter Noisy box 'm6'
2025-11-19 17:04:45,540 INFO circuit_iter Noisy box 'm7'
2025-11-19 17:04:45,567 INFO commutator_bounds Total number of spawned tasks: 4632
2025-11-19 17:04:45,957 INFO commutator_bounds Progress: ...........                                        [1101/4632] 23.8%
2025-11-19 17:04:46,925 INFO commutator_bounds Progress: ...............................                    [2872/4632] 62.0%
2025-11-19 17:04:47,503 INFO commutator_bounds Progress: ....................................               [3391/4632] 73.2%
2025-11-19 17:04:47,555 INFO commutator_bounds Progress: .....................................              [3430/4632] 74.1%
2025-11-19 17:04:48,226 INFO commutator_bounds Progress: ..........................................         [3930/4632] 84.8%
2025-11-19 17:04:48,673 INFO commutator_bounds Progress: ..............................................     [4235/4632] 91.4%
2025-11-19 17:04:49,294 INFO commutator_bounds Progress: .................................................  [4585/4632] 99.0%
2025-11-19 17:04:49,310 INFO commutator_bounds Progress: .................................................  [4594/4632] 99.2%
2025-11-19 17:04:49,347 INFO commutator_bounds Progress: .................................................. [4613/4632] 99.6%
2025-11-19 17:04:49,356 INFO commutator_bounds Progress: .................................................. [4621/4632] 99.8%
2025-11-19 17:04:49,367 INFO commutator_bounds Progress: .................................................. [4629/4632] 99.9%
2025-11-19 17:04:49,375 INFO commutator_bounds Progress: .................................................. [4631/4632] 100.0%
2025-11-19 17:04:49,376 INFO commutator_bounds Progress: .................................................. [4632/4632] 100.0%
2025-11-19 17:04:49,376 INFO commutator_bounds Successfully completed [4632/4632] tasks!
2025-11-19 17:04:49,651 WARNING merge Missing noise rates. Partitioning backward/forward commutator bounds by assuming uniform error rates.
2025-11-19 17:04:49,651 WARNING merge Optimal spacetime partitioning not implemented!Just partitioning list of noisy boxes.
2025-11-19 17:04:49,651 INFO merge Determined Box idx for partitioning to be 0.
2025-11-19 17:04:50,103 INFO base_tasks Pass: ContainsInstruction - 0.01597 (ms)
2025-11-19 17:04:50,103 INFO base_tasks Pass: UnitarySynthesis - 0.00906 (ms)
2025-11-19 17:04:50,103 INFO base_tasks Pass: HighLevelSynthesis - 0.01359 (ms)
2025-11-19 17:04:50,103 INFO base_tasks Pass: BasisTranslator - 0.00668 (ms)
2025-11-19 17:04:50,103 INFO base_tasks Pass: SetLayout - 0.05150 (ms)
2025-11-19 17:04:50,103 INFO base_tasks Pass: FullAncillaAllocation - 0.02027 (ms)
2025-11-19 17:04:50,103 INFO base_tasks Pass: EnlargeWithAncilla - 0.00429 (ms)
2025-11-19 17:04:50,103 INFO base_tasks Pass: ApplyLayout - 0.15640 (ms)
2025-11-19 17:04:50,103 INFO base_tasks Pass: CheckMap - 0.00262 (ms)
2025-11-19 17:04:50,104 INFO base_tasks Pass: FilterOpNodes - 0.11396 (ms)
2025-11-19 17:04:50,104 INFO base_tasks Pass: UnitarySynthesis - 0.00429 (ms)
2025-11-19 17:04:50,104 INFO base_tasks Pass: HighLevelSynthesis - 0.04721 (ms)
2025-11-19 17:04:50,104 INFO base_tasks Pass: BasisTranslator - 0.00238 (ms)
2025-11-19 17:04:50,104 INFO base_tasks Pass: ContainsInstruction - 0.00429 (ms)
2025-11-19 17:04:50,104 INFO transpiler Total Transpile Time - 410.64262 (ms)
2025-11-19 17:04:50,129 WARNING merge Optimal spacetime partitioning not implemented!Just partitioning list of noisy boxes.
2025-11-19 17:04:50,129 INFO merge Determined Box idx for partitioning to be 0.

@mrossinek mrossinek marked this pull request as ready for review November 20, 2025 14:42
@mrossinek mrossinek merged commit 5b365f9 into main Nov 28, 2025
13 checks passed
@mrossinek mrossinek deleted the async-parallel branch November 28, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants