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: Script for CircuitMatcher precompilation #89

Merged
merged 5 commits into from
Sep 6, 2023
Merged

Conversation

lmondada
Copy link
Contributor

@lmondada lmondada commented Sep 5, 2023

As an example, you can run

cargo run --bin compile-matcher --features="portmatching,binaries" -- -i test_files/T_Tdg_H_X_CX_complete_ECC_set.json

It should give you the following output:

Loaded 4913 patterns.
Building matcher...
Written matcher to "./matcher.bin"
File size: 7.21 MB

You can get the ECC file in this example from my feature/bench-patterns branch:

git checkout feature/bench-patterns -- test_files/T_Tdg_H_X_CX_complete_ECC_set.json

@lmondada lmondada requested a review from aborgna-q September 5, 2023 14:11
src/bin/compile-matcher.rs Outdated Show resolved Hide resolved
short,
long,
value_name = "FILE",
help = "Sets the input file or folder to use. It is either a JSON file of Quartz-generated ECCs or a folder with TK1 circuits in JSON format."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps the quartz vs tk1 input parameters could be different flags, but this is alright for now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(maybe with an clap::ArgGroup)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, we will need to encode how these patterns are translated into rewrites. This data is given implicitly in the ECC file but not if the patterns are in a folder. I'll add a TODO.

Cargo.toml Outdated
@@ -62,12 +64,16 @@ urlencoding = "2.1.2"
name = "bench_main"
harness = false

[[bin]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the best option here would be to make a sub-package in the workspace (similar to pyrs), so we don't pollute the package.

@lmondada lmondada requested a review from aborgna-q September 5, 2023 17:11
clap = { version = "4.4.2", features = ["derive"] }
tket2 = { path = "../", features = ["portmatching"] }
quantinuum-hugr = { workspace = true }
itertools = "0.11.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is also used by tket2, so add it to the workspace.dependencies to avoid version mismatches (as with quantinuum-hugr).

@lmondada lmondada merged commit 20d63a2 into main Sep 6, 2023
7 checks passed
@lmondada lmondada deleted the feat/precompile-bin branch September 6, 2023 10: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.

2 participants