Skip to content

feat: Parallelize path simulations#372

Open
speller26 wants to merge 6 commits into
mainfrom
branch
Open

feat: Parallelize path simulations#372
speller26 wants to merge 6 commits into
mainfrom
branch

Conversation

@speller26
Copy link
Copy Markdown
Member

Issue #, if available:

Description of changes:

Gives implementers the option to run path simulations in separate processes; this could be particularly helpful for remote simulator backends.

Testing done:

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Gives implementers the option to run path simulations in separate processes; this could be particularly helpful for remote simulator backends.
@speller26 speller26 requested a review from AbeCoull May 1, 2026 16:12
@speller26 speller26 requested a review from a team as a code owner May 1, 2026 16:12
@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b9e18eb) to head (7ca7959).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #372   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           49        49           
  Lines         4879      4898   +19     
  Branches       560       562    +2     
=========================================
+ Hits          4879      4898   +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

return self.run_jaqcd(circuit_ir, *args, **kwargs)

@property
def parallelize_paths(self) -> bool:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be an int to allow for configurable thread count?

# Aggregate samples across all active paths
paths = list(context.active_paths)
if self.parallelize_paths and len(paths) > 1:
with ThreadPoolExecutor() as pool:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the performance impact of this verse letting the simulator parallelize each serial simulation?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have the same question. In the beginning there is only one path, and the paths are only added during a path simulation. Would it cause a conflict? Is there really a performance gain?

)
sim.evolve(path.instructions)
all_samples.extend(sim.retrieve_samples())
for samples in per_path_samples:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not use per_path_samples?

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