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

[Prototype] Add mini.qubit for testing and reference #5445

Closed
wants to merge 3 commits into from
Closed

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Mar 27, 2024

Context:

This exploration can potentially solve two issues:

  1. Providing a stripped-down reference for plugin developers, helping distinguish between what is required for a device, and the extra features that default.qubit provides. Many of the performance optimizations and bonus features available in default.qubit are not necessary for plugins, and make the source code more difficult to get through.

  2. Allowing testing on a feature-less device. Sometimes code will work on default.qubit, but not any other device because default.qubit has features that normal plugins do not. By testing with mini.qubit, we have

Description of the Change:

There are two main parts to this draft:

  1. Add mini.qubit device
  2. Fix bugs found by testing mini.qubit

Work from two other branches are included: fix_vmap and non-commuting-expanding-fixes.

Benefits:

Possible Drawbacks:

Related GitHub Issues:

Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.


"""

name = "mini.qubit"
Copy link
Member

Choose a reason for hiding this comment

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

Minor comment, but if you want to name it reference.qubit, it will help enforce that it is a reference device for future developers, and minimize users finding/using it :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@albi3ro any concerns with calling it reference.qubit? I also like reference more than mini - which could sound like it's for small scale simulations.

Args:
wires (int, Iterable[Number, str]): Number of wires present on the device, or iterable that
contains unique labels for the wires as numbers (i.e., ``[-1, 0, 2]``) or strings
(``['ancilla', 'q1', 'q2']``). Default ``None`` if not specified. While this device allows
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
(``['ancilla', 'q1', 'q2']``). Default ``None`` if not specified. While this device allows
(``['auxiliary', 'q1', 'q2']``). Default ``None`` if not specified. While this device allows

@trbromley
Copy link
Contributor

How shall we proceed with this PR? Is this something that could be put in the Q3 technical roadmap?

@albi3ro
Copy link
Contributor Author

albi3ro commented May 15, 2024

How shall we proceed with this PR? Is this something that could be put in the Q3 technical roadmap?

I would 100% say this is something we should add at some point in the future, when we have time. Both because it allows us to have much more robust testing, and because it forms a useful jumping off spot for device developers. Q3 technical roadmap might be a good spot.

@trbromley
Copy link
Contributor

How shall we proceed with this PR? Is this something that could be put in the Q3 technical roadmap?

I would 100% say this is something we should add at some point in the future, when we have time. Both because it allows us to have much more robust testing, and because it forms a useful jumping off spot for device developers. Q3 technical roadmap might be a good spot.

Nice! Looks like [SC-65558] is the story.

name="mini.qubit",
)
program.add_transform(
diagonalize_measurements, stopping_condition=supports_operation, name="mini.qubit"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
diagonalize_measurements, stopping_condition=supports_operation, name="mini.qubit"
diagonalize_measurements, supported_base_obs=(qml.Z,), name="mini.qubit"

Comment on lines +68 to +70
if tape.shots:
samples = sample_state(state, shots=tape.shots.total_shots, seed=seed)
results = tuple(mp.process_samples(samples, tape.wires) for mp in tape.measurements)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to add shot vector support here?



@transform
def split_up_non_commuting(tape):
Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably remove this now.

astralcai added a commit that referenced this pull request Sep 17, 2024
Created from #5445

[sc-65558]

---------

Co-authored-by: dwierichs <david.wierichs@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
mudit2812 pushed a commit that referenced this pull request Sep 18, 2024
Created from #5445

[sc-65558]

---------

Co-authored-by: dwierichs <david.wierichs@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
mudit2812 pushed a commit that referenced this pull request Sep 23, 2024
Created from #5445

[sc-65558]

---------

Co-authored-by: dwierichs <david.wierichs@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
@albi3ro
Copy link
Contributor Author

albi3ro commented Oct 16, 2024

Completed by #6181

@albi3ro albi3ro closed this Oct 16, 2024
@albi3ro albi3ro deleted the mini-dev branch October 16, 2024 18:48
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.

5 participants