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

fix: Seen circuits may be accepted again #167

Merged
merged 3 commits into from
Oct 4, 2023
Merged

Conversation

lmondada
Copy link
Contributor

@lmondada lmondada commented Oct 4, 2023

It seems I have found a bug in multi-threaded TASO. Maybe this helps explain the bad performance?

I have run a test on 4 cores, 15seconds timeout, the results are marginally better:

on main

Compiling rewriter...
Using 4 threads
Optimising...
new best of size (major=192, minor=326)
new best of size (major=190, minor=324)
new best of size (major=188, minor=322)
new best of size (major=186, minor=320)
new best of size (major=184, minor=318)
new best of size (major=182, minor=316)
new best of size (major=180, minor=314)
Timeout
Optimisation finished
Tried 19447 circuits
END RESULT: (major=180, minor=314)
Joining worker threads
Saving result
Peak memory usage: 6.131306 GB
Done.

this PR

Compiling rewriter...
Using 4 threads
Optimising...
new best of size (major=192, minor=326)
new best of size (major=190, minor=324)
new best of size (major=188, minor=322)
new best of size (major=186, minor=320)
new best of size (major=184, minor=318)
new best of size (major=182, minor=316)
new best of size (major=180, minor=314)
new best of size (major=178, minor=312)
Timeout
Optimisation finished
Tried 18765 circuits
END RESULT: (major=178, minor=312)
Joining worker threads
Saving result
Peak memory usage: 7.384696 GB
Done.

@lmondada lmondada requested a review from aborgna-q October 4, 2023 10:09
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.

Nice catch!

The diff doesn't show it, so for reference: hashed_circs was being sent without dropping the seen circs after the loop.

@@ -133,11 +133,11 @@ where
let rewrites = self.rewriter.get_rewrites(&circ);
for new_circ in self.strategy.apply_rewrites(rewrites, &circ) {
let new_circ_hash = new_circ.circuit_hash();
circ_cnt += 1;
logger.log_progress(circ_cnt, Some(pq.len()), seen_hashes.len());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move the progress after the circuit_cnt increase (otherwise this may cause duplicated logs if circ_cnt is a round number.

Comment on lines 247 to 248
logger.log_progress(circ_cnt, None, seen_hashes.len());
circ_cnt += 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here,

Suggested change
logger.log_progress(circ_cnt, None, seen_hashes.len());
circ_cnt += 1;
circ_cnt += 1;
logger.log_progress(circ_cnt, None, seen_hashes.len());

@lmondada
Copy link
Contributor Author

lmondada commented Oct 4, 2023

Nvm, after merging in #156 this was fixed anyways.

@lmondada lmondada merged commit 7099098 into main Oct 4, 2023
@lmondada lmondada deleted the fix/taso-multi-seenhashes branch October 4, 2023 11:22
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.

2 participants