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

[Runtime] check amazon-braket-pennylane-plugin's version #724

Open
wants to merge 7 commits into
base: v0.6.1-rc
Choose a base branch
from

Conversation

erick-xanadu
Copy link
Contributor

@erick-xanadu erick-xanadu commented May 7, 2024

Context: To help users understand which version of amazon-braket-pennylane-plugin is compatible with catalyst

Description of the Change:

  • raise an error if an incompatible version of amazon-braket-pennylane-plugin is found.
  • Also adds dependency to semantic_version module in order check non-trivial version compatibilities.

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@erick-xanadu erick-xanadu requested a review from dime10 May 7, 2024 15:22
Comment on lines 121 to 123
from braket.aws import AwsDevice
from braket.devices import LocalSimulator
from braket.ir.openqasm import Program as OpenQasmProgram
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking at this, do we even have a dependency on the amazon-braket-pennylane-plugin ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We never import amazon-braket-pennylane-plugin. But we obtain a class BraketQubitDevice(QubitDevice): from pennylane itself. Which is defined in amazon-braket-pennylane-plugin.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could also make this change in the runtime.py file. Somewhere around these lines.

    if dname == "braket.local.qubit":  # pragma: no cover
        device_kwargs["device_type"] = dname
        device_kwargs["backend"] = (
            # pylint: disable=protected-access
            device._device._delegate.DEVICE_ID
        )
    elif dname == "braket.aws.qubit":  # pragma: no cover
        device_kwargs["device_type"] = dname
        device_kwargs["device_arn"] = device._device._arn  # pylint: disable=protected-access
        if device._s3_folder:  # pylint: disable=protected-access
            device_kwargs["s3_destination_folder"] = str(
                device._s3_folder  # pylint: disable=protected-access
            )

@@ -603,7 +603,7 @@ jobs:
- name: Install additional dependencies (OpenQasm device)
if: ${{ matrix.backend == 'openqasm' }}
run: |
pip install numpy amazon-braket-sdk
pip install numpy amazon-braket-sdk amazon-braket-pennylane-plugin>=1.27.1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
pip install numpy amazon-braket-sdk amazon-braket-pennylane-plugin>=1.27.1
pip install numpy amazon-braket-pennylane-plugin

@erick-xanadu
Copy link
Contributor Author

Closed. It was decided we are going to try to open a PR for SProd and Sum to the amazon-braket-pennylane-plugin github repo.

@erick-xanadu erick-xanadu reopened this May 7, 2024
@erick-xanadu
Copy link
Contributor Author

@dime10 we had a brief discussion offline, you said you still want this code in master?

@dime10
Copy link
Collaborator

dime10 commented May 8, 2024

Yes I think the version check is still a good improvement to the user's experience :)

Is there a way to add a test that it is working as intended?

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.

None yet

2 participants