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

feat: Add Taso optimiser #104

Merged
merged 18 commits into from
Sep 15, 2023
Merged

feat: Add Taso optimiser #104

merged 18 commits into from
Sep 15, 2023

Conversation

lmondada
Copy link
Contributor

From the taso-optimiser folder, you should be able to run

cargo run -- -i ../test_files/barenco_tof_5.json -e ../test_files/T_Tdg_H_X_CX_complete_ECC_set.json

and see the Barenco benchmark circuit getting optimised.

However, currently it doesn't actually optimise atm, I don't know why that is the case. We need to look into it. Maybe I just haven't let it run long enough...

@lmondada
Copy link
Contributor Author

Don't get too scared by the +10k (I got scared too), it's just an ECC file for testing.

@lmondada lmondada requested a review from aborgna-q September 13, 2023 16:29
@lmondada
Copy link
Contributor Author

Oh never mind, it did optimise over the course of 3 hours:

circ_len,time
170,2023-09-13T19:24:36.688377582+00:00
169,2023-09-13T20:28:51.967100501+00:00
168,2023-09-13T20:28:52.622432382+00:00
167,2023-09-13T21:02:41.329484291+00:00
166,2023-09-13T21:02:41.921926016+00:00
165,2023-09-13T22:25:14.847181919+00:00
164,2023-09-13T22:36:59.194159263+00:00

it's soooo sloooooow

@lmondada
Copy link
Contributor Author

Turns out it works quite a bit better when using their pre-processed circuits (at test_files/barenco_tof_5_rm.json):

circ_len,time
206,2023-09-14T13:18:24.545665051+00:00
205,2023-09-14T13:18:25.142003925+00:00
204,2023-09-14T13:18:25.706010856+00:00
203,2023-09-14T13:18:26.245997454+00:00
202,2023-09-14T13:18:26.763931905+00:00
201,2023-09-14T13:18:27.276180371+00:00
200,2023-09-14T13:18:27.765303593+00:00
199,2023-09-14T13:18:28.249595660+00:00
198,2023-09-14T13:18:28.710415772+00:00
197,2023-09-14T13:18:29.149414946+00:00
196,2023-09-14T13:18:29.584134558+00:00
195,2023-09-14T13:18:29.995713637+00:00
194,2023-09-14T13:18:30.403057919+00:00
193,2023-09-14T13:18:30.788904410+00:00
192,2023-09-14T13:18:31.153803780+00:00
191,2023-09-14T13:18:37.082077672+00:00
190,2023-09-14T13:18:44.071283876+00:00

within 40 seconds

taso-optimiser/src/main.rs Outdated Show resolved Hide resolved
src/passes/taso.rs Outdated Show resolved Hide resolved
src/passes/taso.rs Outdated Show resolved Hide resolved
src/passes/taso.rs Outdated Show resolved Hide resolved
taso-optimiser/src/main.rs Outdated Show resolved Hide resolved
src/passes/taso.rs Outdated Show resolved Hide resolved
src/passes/taso.rs Outdated Show resolved Hide resolved
src/passes/taso.rs Outdated Show resolved Hide resolved
src/passes/taso.rs Outdated Show resolved Hide resolved
aborgna-q added a commit that referenced this pull request Sep 14, 2023
Required for some #104 ecc sets.

Note that the published `tket-json-rs` dropped the `tket2` feature. But
it should be fine once CQCL/tket-json-rs#13 is
merged and published.
src/passes/taso.rs Outdated Show resolved Hide resolved
# Conflicts:
#	src/json/op.rs
seen_hashes.insert(hash);
}
// try to send to first available thread
if let Some(next_ind) = cycle_inds.by_ref().take(n_threads).find(|next_ind| {
Copy link
Collaborator

Choose a reason for hiding this comment

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

A crossbeam-channel would simplify this quite a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a TODO for this.

@lmondada
Copy link
Contributor Author

I've reorganised the code quite a bit: mainly moved from the passes module to a new optimiser module. I've also introduced a TasoOptimiser struct. For the time being I am not exposing MPSC taso as it needs to be significantly reworked once we've figured out the single-thread case.

I apologise for the significant rewrite -- the code logic hasn't changed however, so hopefully reviewing this shouldn't be too time consuming.

@lmondada lmondada requested a review from aborgna-q September 15, 2023 05:32
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.

Awesome :D

src/json.rs Outdated Show resolved Hide resolved
src/json.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
taso-optimiser/src/main.rs Outdated Show resolved Hide resolved
taso-optimiser/src/main.rs Outdated Show resolved Hide resolved
src/optimiser/taso.rs Outdated Show resolved Hide resolved
lmondada and others added 4 commits September 15, 2023 13:59
Co-authored-by: Agustín Borgna <[email protected]>
Co-authored-by: Agustín Borgna <[email protected]>
Co-authored-by: Agustín Borgna <[email protected]>
Co-authored-by: Agustín Borgna <[email protected]>
lmondada and others added 2 commits September 15, 2023 14:00
Co-authored-by: Agustín Borgna <[email protected]>
Co-authored-by: Agustín Borgna <[email protected]>
@lmondada lmondada merged commit b8a34b7 into main Sep 15, 2023
@lmondada lmondada deleted the feat/update-taso branch September 15, 2023 12:04
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