Braket.jl icon indicating copy to clipboard operation
Braket.jl copied to clipboard

Feature request: integration with Yao ecosystem

Open kshyatt-aws opened this issue 2 years ago • 21 comments

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

kshyatt-aws avatar Dec 07 '22 17:12 kshyatt-aws

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

Roger-luo avatar Dec 07 '22 17:12 Roger-luo

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.

ruihao-li avatar Feb 17 '23 16:02 ruihao-li

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.

kshyatt-aws avatar Feb 17 '23 16:02 kshyatt-aws

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

ruihao-li avatar Feb 17 '23 17:02 ruihao-li

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

kshyatt-aws avatar Feb 17 '23 17:02 kshyatt-aws

Awesome! Thanks Katharine.

ruihao-li avatar Feb 17 '23 17:02 ruihao-li

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

Roger-luo avatar Feb 17 '23 22:02 Roger-luo

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!

ruihao-li avatar Feb 28 '23 19:02 ruihao-li

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

Roger-luo avatar Feb 28 '23 19:02 Roger-luo

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?

ruihao-li avatar Feb 28 '23 20:02 ruihao-li

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 does using Braket, Yao this package will get loaded automatically. What do @kshyatt-aws think?

Roger-luo avatar Feb 28 '23 20:02 Roger-luo

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

kshyatt-aws avatar Mar 01 '23 01:03 kshyatt-aws

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:

  • Take some of the simulator tests in this package's test/integ/ and port them to Yao, but still run them on the Braket (local) simulators, to make sure circuit and result translation work
  • Similarly, reimplement some of the non-AHS, non-PennyLane examples and check the results are consistent.

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.

kshyatt-aws avatar Mar 01 '23 16:03 kshyatt-aws

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.

ruihao-li avatar Mar 02 '23 14:03 ruihao-li

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

kshyatt-aws avatar Mar 02 '23 14:03 kshyatt-aws

@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

Roger-luo avatar Mar 02 '23 20:03 Roger-luo

@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?

ruihao-li avatar Mar 03 '23 15:03 ruihao-li

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.

Roger-luo avatar Mar 03 '23 15:03 Roger-luo

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

kshyatt-aws avatar Mar 21 '23 15:03 kshyatt-aws

@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?

ruihao-li avatar Mar 21 '23 15:03 ruihao-li

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

kshyatt-aws avatar Mar 21 '23 16:03 kshyatt-aws