amazon-braket / Braket.jl

Experimental Julia implementation of the Amazon Braket SDK
Apache License 2.0
99 stars 7 forks source link

Feature request: integration with Yao ecosystem #16

Open kshyatt-aws opened 1 year ago

kshyatt-aws commented 1 year ago

Describe the feature you'd like Integrate Braket.jl and Yao.jl to allow Yao users to run circuits/AHS programs on Braket.

Is this feature already present in the Python SDK? No.

How would this feature be used? Please describe. Would allow Yao users to seamlessly run their existing quantum circuits on real QPUs. Would also enable Bloqade users to run AHS programs directly on QuEra's Aquila device.

cc: @Roger-luo @GiggleLiu

Roger-luo commented 1 year ago

For reference a good starting point is to look at the schema translation project for IBM Q: https://github.com/QuantumBFS/YaoBlocksQobj.jl and for OpenQASM: https://github.com/QuantumBFS/YaoBlocksQASM.jl

ruihao-li commented 1 year ago

Hi @kshyatt-aws, @egolias1 and I are interested in working on this, potentially as a Hackathon project for QHack. Before getting started, we would like to ask if you want this feature to be something integrated in Braket.jl or a standalone package like the two projects highlighted by @Roger-luo? Thank you.

kshyatt-aws commented 1 year ago

Hello,

That's awesome 🤩 . To my mind, it would make sense to start as a separate, standalone package - that way you don't need to rely on me to merge things or to unblock CI for you. Once you're up and running we can consider whether it would make sense to fold it in here as a subpackage (like PyBraket), add it to the Yao org, or keep it independent.

This is really exciting! Please don't hesitate to reach out at any time if you run into issues or need clarification on something.

ruihao-li commented 1 year ago

Great! Thanks for the clarification. That makes sense.

Would you still be on the Discord channel for the QHack period in case we encounter any technical difficulties? If not, what would be the best way to reach you? @kshyatt-aws

kshyatt-aws commented 1 year ago

Absolutely, I plan to be in the QHack discord throughout the event. You can also reach out to me on Julia slack (kshyatt there).

ruihao-li commented 1 year ago

Awesome! Thanks Katharine.

Roger-luo commented 1 year ago

Please also feel free to ask questions in Julia slack at #yao-dev channel or just post issues under Yao's repo.

ruihao-li commented 1 year ago

Hi @kshyatt-aws, @Roger-luo, I just finished prototyping the Yao-to-Braket translation here. At this point it does not contain support for Bloqade. It basically follows the two projects provided by Roger. I just wanted to get some initial feedbacks from you to see if I'm on the right track and if this is the implementation you wanted. Any comments/suggestions are greatly appreciated!

Roger-luo commented 1 year ago

Thanks @ruihao-li It looks quite nice, it would be nicer if you could setup a CI and write some tests for the package, so we can know the detailed interface of what you write and guarantee the correctness of the implementation. You can copy paste the CI configurations from here: https://github.com/Roger-luo/Configurations.jl/blob/main/.github/workflows/tests.yml

ruihao-li commented 1 year ago

Thanks @Roger-luo for the suggestions! I added the CI. I have some preliminary tests inside. Is there any particular tests you have in mind?

Roger-luo commented 1 year ago

No, I think the current test looks good already, I just want to make sure the test coverage is high enough. I think since now Julia has weakdeps, it might make sense to move that package to Braket.jl as an extension package (or in Yao repo) now, so when someone doesusing Braket, Yao this package will get loaded automatically. What do @kshyatt-aws think?

kshyatt-aws commented 1 year ago

Amazing! I'll take a detailed look tomorrow but it's awesome to see this.

kshyatt-aws commented 1 year ago

OK! I think in terms of tests, it would be great to re-implement as many of the Yao easybuild tests as are feasible. Ideally the ones you can run on the local simulators through PyBraket, so that you don't need to spend credits.

Additional ideas:

Does the plugin wrap any of the Braket "quality of life" features, such as cost tracking or Hybrid Jobs? I don't think these are necessary for a first release but if there is a nice way to integrate them, that would be great.

PS. don't forget to make a PR to the Yao docs once this is released to update

Using Yao, we can simulate the qubits, without having a quantum computer(based on the known mathematical and physics rules), although the support to run your circuits on Yao using real qubits is coming to Yao soon.

😉

In tems of the weakdeps idea suggested by @Roger-luo , I think that would be great. It might make sense for this to live in the Yao org initially but we can discuss once the tests are in place.

ruihao-li commented 1 year ago

Thanks for the great suggestions, @kshyatt-aws! I will start working on the tests and think about the "quality of life" features you mentioned (which the plugin does not support right now) after the March Meeting.

kshyatt-aws commented 1 year ago

Great. Please reach out if you run into any issues, and enjoy March Meeting!

Roger-luo commented 1 year ago

@ruihao-li please feel free to tag me to transfer the repo to Yao org, we might be able to accept it as part of a Yao extension since the implementation is quite simple. But probably need to wait on 1.9 is out as release

ruihao-li commented 1 year ago

@Roger-luo Sure thing. Thanks. When do you think it's a good time to make the transfer? After more tests are implemented, or after Julia 1.9 is out?

Roger-luo commented 1 year ago

After Julia 1.9 is out is better, so we don't need to change the CI, but perhaps you could open a PR first and we can merge it (and give a final test) when it's out.

kshyatt-aws commented 1 year ago

Just coming back to (gently) ping @ruihao-li - any updates? Anything I can help with?

ruihao-li commented 1 year ago

@kshyatt-aws Sorry for being silent for a while. I was unfortunately sick last week and had some personal matters to attend to. My plan for now is to revise the implementation and open a PR for making it a Yao extension by the end of this week. Then more tests can be added. What do you think?

kshyatt-aws commented 1 year ago

No worries! Sorry to hear you were sick, hope things are better now. The plan sounds good to me!