Skip to content
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

chore: Move parallel evaluation code to CircuitChunks #528

Merged
merged 4 commits into from
Aug 5, 2024

Conversation

potatoboiler
Copy link
Contributor

resolves #266

@potatoboiler potatoboiler requested a review from a team as a code owner August 5, 2024 10:12
@potatoboiler potatoboiler requested a review from aborgna-q August 5, 2024 10:12
@potatoboiler potatoboiler changed the title Move parallel evaluation code to CircuitChunks chore: Move parallel evaluation code to CircuitChunks Aug 5, 2024
Copy link

codecov bot commented Aug 5, 2024

Codecov Report

Attention: Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.

Project coverage is 84.00%. Comparing base (7c14494) to head (e1fd6d8).

Files Patch % Lines
tket2/src/optimiser/badger/log.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #528      +/-   ##
==========================================
+ Coverage   83.96%   84.00%   +0.03%     
==========================================
  Files          61       61              
  Lines        6685     6700      +15     
  Branches     6191     6206      +15     
==========================================
+ Hits         5613     5628      +15     
- Misses        790      791       +1     
+ Partials      282      281       -1     
Flag Coverage Δ
python 95.34% <ø> (ø)
rust 83.09% <82.35%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Collaborator

@aborgna-q aborgna-q left a comment

Choose a reason for hiding this comment

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

Hi, thanks for the PR! It looks like it improves the badger optimiser startup time quite a lot :)

I just have a small style suggestion.

@@ -440,7 +441,7 @@ where
logger.log_best(circ_cost.clone(), num_rewrites);

let (joins, rx_work): (Vec<_>, Vec<_>) = chunks
.iter_mut()
Copy link
Collaborator

@aborgna-q aborgna-q Aug 5, 2024

Choose a reason for hiding this comment

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

I wasn't sure if this would improve the runtime, since the map block below is mostly just about creating new threads. But a quick test showed that this whole let (joins, rx_works) = ... block is now a lot faster!

On my laptop, trying multiple shots of

cargo run -p badger-optimiser --release -- -e test_files/eccs/nam_6_3.rwr -i 
test_files/barenco_tof_10.json --split-circ -j N

while measuring the block time I get

Threads (N) Block time with iter_mut with par_iter_mut Comparison
2 100ms 57ms 0.57
10 719ms 471ms 0.65

tket2/src/passes/chunks.rs Outdated Show resolved Hide resolved
@aborgna-q aborgna-q enabled auto-merge August 5, 2024 14:16
@aborgna-q aborgna-q added this pull request to the merge queue Aug 5, 2024
Merged via the queue into CQCL:main with commit 209b342 Aug 5, 2024
16 checks passed
@aborgna-q aborgna-q mentioned this pull request Aug 8, 2024
@hugrbot hugrbot mentioned this pull request Aug 19, 2024
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.

Move parallel evaluation code to CircuitChunks
2 participants