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

Creates fake grid device for testing qubit connectivity in routing #5830

Conversation

ammareltigani
Copy link
Contributor

This PR is creates a fake device to be used only for testing qubit connectivity in routing procedures. It only creates grid (square) devices for now in the cirq-core/testing directory. Other device architectures like ring devices will be added in the future.

For more context see, http://tinyurl.com/cirq-qubit-routing

@ammareltigani ammareltigani requested review from a team, vtomole and cduck as code owners August 16, 2022 18:12
@CirqBot CirqBot added the size: M 50< lines changed <250 label Aug 16, 2022
Copy link
Collaborator

@tanujkhattar tanujkhattar left a comment

Choose a reason for hiding this comment

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

Can you branch it off of the master branch so the changed files are only the files added / modified in cirq/testing/* directory? I believe there shouldn't be a dependency on any other routing utility being added in other parallel PRs.

@ammareltigani ammareltigani force-pushed the routing-initial_mapping_device_setup branch from 6bca59a to 7819263 Compare August 17, 2022 00:15
@ammareltigani
Copy link
Contributor Author

Can you branch it off of the master branch so the changed files are only the files added / modified in cirq/testing/* directory? I believe there shouldn't be a dependency on any other routing utility being added in other parallel PRs.

Yes. All done.

cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
ammareltigani added a commit to ammareltigani/Cirq that referenced this pull request Aug 19, 2022
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
@ammareltigani ammareltigani requested review from mpharrigan and tanujkhattar and removed request for verult, mpharrigan and tanujkhattar August 19, 2022 22:30
@ammareltigani ammareltigani removed the request for review from tanujkhattar August 19, 2022 22:38
Copy link
Collaborator

@tanujkhattar tanujkhattar left a comment

Choose a reason for hiding this comment

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

LGTM % nits

cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
cirq-core/cirq/testing/routing_devices.py Outdated Show resolved Hide resolved
@ammareltigani ammareltigani requested review from tanujkhattar and removed request for mpharrigan August 20, 2022 00:19
@tanujkhattar tanujkhattar merged commit 79d7250 into quantumlib:master Aug 20, 2022
tanujkhattar added a commit that referenced this pull request Sep 2, 2022
* added abstract initial mapper and identity initial mapper

* added __str__ and __repr__ for MappingManager

* minor bug

* made MappingManager not serializable

* removed unused import

* pushed AbstractInitialMapping and IdentityInitialMapping name to 'cirq' namespace; made both classes not serializable

* minor lint fix

* addressed comments

* addressed comments

* fixed bug with edges not being sorted for graph equality testing

* fixed bug with digraphs repr method in MappingManager and added test for it

* addressed some comments

* added grid testing device

* added grid routing testing device

* formatting

* added line_initial_mapper and some tests; needs more testing

* formatting

* formatting

* changed interface for LineInitialMapper and added better tests; test for directed graph value equality remaining

* addressed comments and added ring device

* added test for supportin directed graphs

* changed interface for AbstractInitialMapper

* formatting

* changed RoutingTestingDevice interface; need to change is_isomorphic tests

* added hard-coded isomorphism tests

* fixed type issue

* removed redundant imports

* merged with routing testing device PR #5830

* simplified _value_equalit_values_

* addressed comments

* removed unused import

* pasted routing files

* fixed nits

* cleaned up circuit transformer class; needs tests

* addressed comments

* formatting

* small fixes

* removed unused import

* modified test file

* debugging

* removed print statements

* debugging statement

* debugging statement

* fix

* fix

* print statement

* edges sorting

* addressed comments; ready for review

* fixed type bug

* cleanup

* wrote some tests

* ready for review

* type and lint fixes

* working for basic tests

* slightly modified _make_circuit_graph()

* added some tests

* added test for testing valid circuits and fixed bug in _make_circuit_graph()

* debugging currently

* made dict of dict storing pqubit distances into numpy integer numpy array

* made dict of dict storing pqubit distances into numpy integer numpy array

* used better cost function that sped up algorithm by a lot

* cleaned up a little and added coverage tests

* removed unitary testing code; will add it in next PR

* fixed lint and type issues

* small lint fix

* added unitary testing for routed circuits

* changed api to accept only a final mapping of a set of qubits to itself

* fixed typos

* fixed some docstrings, changed __call__ and route_circuit() order, and move a class function to free function

* added tests

* refactored _get_timesteps() as per suggestion

* more fixes

* changed construction of two and single qubit ops lists

* fixed bug from _get_two_qubit_ops and added unitary testing

* addressed comments and refactored _route() function

* minor cleanup

* addressed comments

* made helper functions class variable and passed mapping manager as function argument everywhere

* docstring and nomenclature changes

Co-authored-by: Tanuj Khattar <tanujkhattar@google.com>
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
…uantumlib#5830)

* added grid testing device

* formatting

* addressed comments and added ring device

* changed RoutingTestingDevice interface; need to change is_isomorphic tests

* added hard-coded isomorphism tests

* fixed type issue

* addressed comments

* removed unused import

* fixed nits
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
* added abstract initial mapper and identity initial mapper

* added __str__ and __repr__ for MappingManager

* minor bug

* made MappingManager not serializable

* removed unused import

* pushed AbstractInitialMapping and IdentityInitialMapping name to 'cirq' namespace; made both classes not serializable

* minor lint fix

* addressed comments

* addressed comments

* fixed bug with edges not being sorted for graph equality testing

* fixed bug with digraphs repr method in MappingManager and added test for it

* addressed some comments

* added grid testing device

* added grid routing testing device

* formatting

* added line_initial_mapper and some tests; needs more testing

* formatting

* formatting

* changed interface for LineInitialMapper and added better tests; test for directed graph value equality remaining

* addressed comments and added ring device

* added test for supportin directed graphs

* changed interface for AbstractInitialMapper

* formatting

* changed RoutingTestingDevice interface; need to change is_isomorphic tests

* added hard-coded isomorphism tests

* fixed type issue

* removed redundant imports

* merged with routing testing device PR quantumlib#5830

* simplified _value_equalit_values_

* addressed comments

* removed unused import

* pasted routing files

* fixed nits

* cleaned up circuit transformer class; needs tests

* addressed comments

* formatting

* small fixes

* removed unused import

* modified test file

* debugging

* removed print statements

* debugging statement

* debugging statement

* fix

* fix

* print statement

* edges sorting

* addressed comments; ready for review

* fixed type bug

* cleanup

* wrote some tests

* ready for review

* type and lint fixes

* working for basic tests

* slightly modified _make_circuit_graph()

* added some tests

* added test for testing valid circuits and fixed bug in _make_circuit_graph()

* debugging currently

* made dict of dict storing pqubit distances into numpy integer numpy array

* made dict of dict storing pqubit distances into numpy integer numpy array

* used better cost function that sped up algorithm by a lot

* cleaned up a little and added coverage tests

* removed unitary testing code; will add it in next PR

* fixed lint and type issues

* small lint fix

* added unitary testing for routed circuits

* changed api to accept only a final mapping of a set of qubits to itself

* fixed typos

* fixed some docstrings, changed __call__ and route_circuit() order, and move a class function to free function

* added tests

* refactored _get_timesteps() as per suggestion

* more fixes

* changed construction of two and single qubit ops lists

* fixed bug from _get_two_qubit_ops and added unitary testing

* addressed comments and refactored _route() function

* minor cleanup

* addressed comments

* made helper functions class variable and passed mapping manager as function argument everywhere

* docstring and nomenclature changes

Co-authored-by: Tanuj Khattar <tanujkhattar@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants