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

[UnitaryHack] Enable qiskit transpilation discontinous qubit indices #108

Conversation

WingCode
Copy link
Contributor

Summary

closes #91

Details and comments

Enables qiskit transpilation for Rigetti devices on the qubit coupling map level. If the issues with Rigetti Aspen backend not transpiling QC circuit by converting the discontinous qubit indices into continous one.

Copy link
Collaborator

@jcjaskula-aws jcjaskula-aws left a comment

Choose a reason for hiding this comment

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

I would request a bit of code cleanup and more comments/information of what the code does.
Also, it would be great to expose the mapping better. Once the circuit has been transpiled, how can users verify that the circuit would run on the device. In particular, users might want to use directly their transpiled circuits in verbatim mode (which means without any other compilation steps), which would require the reverse mapping. Considering the remaining time for UH, we can probably pass on this last request.

def convert_continuous_qubit_indices(connectivity_graph: dict) -> dict:
"""Aspen qubit indices are discontinuous (label between x0 and x7, x being the number of the
octagon) while the Qiskit transpiler creates and/or handles coupling maps with continuous indices.
This function converts the discontinous connectivity graph from Aspen to a continuous one.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we describe how the mapping looks like? The docstring mentions a connectivity graph as arg and output but does not give any indication.

@@ -233,6 +233,28 @@ def local_simulator_to_target(simulator: LocalSimulator) -> Target:
return target


def convert_continuous_qubit_indices(connectivity_graph: dict) -> dict:
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • Why defining a global function for something that will be used only for Rigetti's device?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we push this code in aws_device_to_target()?

indices = [int(key) for key in connectivity_graph.keys()]
indices.sort()
map_list = list(range(0, indices[-1] + 1))
mapper = dict(zip(indices, map_list))
Copy link
Collaborator

Choose a reason for hiding this comment

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

indices and map_list don't have the length. Why not using map_list = list(range(len(indices)))?

@@ -69,3 +69,17 @@ def test_real_device_circuit_execution(self):
)
result = state_vector_backend.run(transpiled_circuit, shots=10)
self.assertTrue(result)

@unittest.skip("Call to external service")
def test_real_device_discontinous_qubit_indices_qiskit_transpilation(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test runs well on 0.0.4. Can you confirm it? If so, could we isolate the problem on 0.0.4 with another test and add it here?

Copy link
Collaborator

@jcjaskula-aws jcjaskula-aws left a comment

Choose a reason for hiding this comment

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

LGTM, let's have a codeowner merge it.

@christianbmadsen christianbmadsen merged commit 9d5150d into qiskit-community:main Jun 19, 2023
4 checks passed
robotAstray added a commit to robotAstray/qiskit-braket-provider that referenced this pull request Jun 19, 2023
* [UnitaryHack] Enable qiskit transpilation discontinous qubit indices (qiskit-community#108)

* convert Rigetti Aspen qubit connectivity continous

* Add qiskit transpilation discountinous qubit indices

* Add more comments, cleanup

* Add more comments, cleanup

* Move in Rigetti branching since not require globally

* Fix lint

* Add better example

* Fix docstring

* Add mock for rigetti aspen m3

* Enable transpilation test

* Fix mypy

* [UnitaryHack] Gate Decomposition(qiskit-community#90) added and tested (qiskit-community#111)

* implement and test gate decomposition

* Implement and Test Gate Decomposition

* addressed comments in previous PR

* Adding separate QUEUED and RUNNING states to task status (qiskit-community#110)

* fix: Updates for Qiskit to Braket circuit conversion (qiskit-community#97)

* Probability to Sample result type

* passes tox lint

* updates toxlint

* fixes observable z error but not passses elint

* unit test added

* final commit with tests

fix: Fallback to JAQCD for device properties (qiskit-community#104)

* fix: Fallback to JAQCD for device properties

* fix: reformat

replacing AWSBraketJob with AmazonBraketTask

run the notebooks containing AmazonBraketTask

deprecation warning added for AWSBraketJob class

formatting fixed

re-add <JOB_ARN>

fix breaking changes on /provider/__init__.py and __init__.py

rename job_id to task_id argument for AmazonBraketTask()

rename braket_jobs_states to braket_tasks_states

add task_id method to access the task_id similar to the one we have in the JobV1 class

adding tests for new class 'AmazonBraketTask' and old class 'AWSBraketJob'

formatting test_braket_job.py

correcting definition of AWSBraketJob

rewriting line 184 in braket_job.py

adding class docstring to AWSBraketJob

standard import 'from warnings import warn'  placed before 'from braket.aws import AwsQuantumTask' (wrong-import-order)

docstring fix in test_braket_job.py

assert the job id in test_AWS_job() function in test_braket_job.py

running how to notebook #0

running how to notebook #1

running how to notebook #2

running how to notebook #3

running how to notebook number 5

running tutorial  notebook number 3

tutorial number 0

* add separate QUEUED and RUNNING states to task status (qiskit-community#46)

---------

Co-authored-by: Yuri Han <45699207+urihan@users.noreply.github.com>

---------

Co-authored-by: WingCode <smallstar1234@gmail.com>
Co-authored-by: Gmontes01 <118773601+Gmontes01@users.noreply.github.com>
Co-authored-by: Yuri Han <45699207+urihan@users.noreply.github.com>
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.

Enable (some) transpilation with Braket
3 participants