By using AWS re:Post, you agree to the Terms of Use
/Quantum Technologies/

Quantum Technologies

Explore and experiment with quantum computing. Amazon Braket is a fully managed service that helps you get started with quantum computing by providing a development environment to explore and design quantum algorithms, test them on simulated quantum computers, and run them on your choice of different quantum hardware technologies.

Recent questions

see all
1/16

¿How can we crate a lambda which uses a Braket D-Wave device?

We are trying to deploy a Lambda with some code which works in a Notebook. The code is rather simple and uses D-Wave — DW_2000Q_6. The problem is that when we execute the lambda (container lambda due to size problems), it give us the following error: ```json { "errorMessage": "[Errno 30] Read-only file system: '/home/sbx_user1051'", "errorType": "OSError", "stackTrace": [ " File \"/var/lang/lib/python3.8/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n", " File \"/var/lang/lib/python3.8/imp.py\", line 171, in load_source\n module = _load(spec)\n", " File \"<frozen importlib._bootstrap>\", line 702, in _load\n", " File \"<frozen importlib._bootstrap>\", line 671, in _load_unlocked\n", " File \"<frozen importlib._bootstrap_external>\", line 843, in exec_module\n", " File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n", " File \"/var/task/lambda_function.py\", line 6, in <module>\n from dwave.system.composites import EmbeddingComposite\n", " File \"/var/task/dwave/system/__init__.py\", line 15, in <module>\n import dwave.system.flux_bias_offsets\n", " File \"/var/task/dwave/system/flux_bias_offsets.py\", line 22, in <module>\n from dwave.system.samplers.dwave_sampler import DWaveSampler\n", " File \"/var/task/dwave/system/samplers/__init__.py\", line 15, in <module>\n from dwave.system.samplers.clique import *\n", " File \"/var/task/dwave/system/samplers/clique.py\", line 32, in <module>\n from dwave.system.samplers.dwave_sampler import DWaveSampler, _failover\n", " File \"/var/task/dwave/system/samplers/dwave_sampler.py\", line 31, in <module>\n from dwave.cloud import Client\n", " File \"/var/task/dwave/cloud/__init__.py\", line 21, in <module>\n from dwave.cloud.client import Client\n", " File \"/var/task/dwave/cloud/client/__init__.py\", line 17, in <module>\n from dwave.cloud.client.base import Client\n", " File \"/var/task/dwave/cloud/client/base.py\", line 89, in <module>\n class Client(object):\n", " File \"/var/task/dwave/cloud/client/base.py\", line 736, in Client\n @cached.ondisk(maxage=_REGIONS_CACHE_MAXAGE)\n", " File \"/var/task/dwave/cloud/utils.py\", line 477, in ondisk\n directory = kwargs.pop('directory', get_cache_dir())\n", " File \"/var/task/dwave/cloud/config.py\", line 455, in get_cache_dir\n return homebase.user_cache_dir(\n", " File \"/var/task/homebase/homebase.py\", line 150, in user_cache_dir\n return _get_folder(True, _FolderTypes.cache, app_name, app_author, version, False, use_virtualenv, create)[0]\n", " File \"/var/task/homebase/homebase.py\", line 430, in _get_folder\n os.makedirs(final_path)\n", " File \"/var/lang/lib/python3.8/os.py\", line 213, in makedirs\n makedirs(head, exist_ok=exist_ok)\n", " File \"/var/lang/lib/python3.8/os.py\", line 213, in makedirs\n makedirs(head, exist_ok=exist_ok)\n", " File \"/var/lang/lib/python3.8/os.py\", line 223, in makedirs\n mkdir(name, mode)\n" ] } ``` It seems that the library tries to write to some files which are not in /tmp folder. I'm wondering if is possible to do this, and if not, what are the alternatives. imports used: ```python import boto3 from braket.ocean_plugin import BraketDWaveSampler from dwave.system.composites import EmbeddingComposite from neal import SimulatedAnnealingSampler ```
1
answers
0
votes
6
views
asked 23 days ago

Should the braket.aws.AwsDevice.get_devices() API return a non-empty list of AWS Braket systems for the us-east-2 region?

Should the `braket.aws.AwsDevice.get_devices()` API return a non-empty list of AWS Braket systems for the `us-east-2` region? (It does). The reason for my question is that it does not look like us-east-2 is a [supported service endpoint for the AWS Braket service](https://docs.aws.amazon.com/general/latest/gr/braket.html), however when the following code is used to query the braket devices available in the `us-east-2` region, a non-empty list of devices is returned: ``` from braket.aws import AwsDevice import sys import os AWS_REGIONS = [ 'us-east-2' ] for region in AWS_REGIONS: os.environ['AWS_DEFAULT_REGION'] = region try: aws_braket_devices = AwsDevice.get_devices(order_by='provider_name') except Exception as exception: exc_type, value, traceback = sys.exc_info() print(f'{exc_type.__name__} calling AwsDevice.get_devices()') raise exception print(f'AWS Braket devices in region {region}') for aws_braket_device in aws_braket_devices: print(f'{aws_braket_device.name:<20}{aws_braket_device.status:<10} {aws_braket_device.arn}') ``` When the code above is run, it prints a list of braket systems in the `us-east-2` region which looks like this: ``` AWS Braket devices in region us-east-2 Advantage_system3.2 OFFLINE arn:aws:braket:::device/qpu/d-wave/Advantage_system3 Advantage_system4.1 ONLINE arn:aws:braket:::device/qpu/d-wave/Advantage_system4 Advantage_system1.1 RETIRED arn:aws:braket:::device/qpu/d-wave/Advantage_system1 DW_2000Q_6 ONLINE arn:aws:braket:::device/qpu/d-wave/DW_2000Q_6 IonQ Device ONLINE arn:aws:braket:::device/qpu/ionq/ionQdevice Aspen-10 RETIRED arn:aws:braket:::device/qpu/rigetti/Aspen-10 Aspen-8 RETIRED arn:aws:braket:::device/qpu/rigetti/Aspen-8 Aspen-9 RETIRED arn:aws:braket:::device/qpu/rigetti/Aspen-9 Aspen-11 ONLINE arn:aws:braket:::device/qpu/rigetti/Aspen-11 ``` However, if a user tries to access any of the ONLINE systems via a `us-east-2` endpoint, the API call will fail as shown in the following example: ``` from braket.aws import AwsDevice import botocore import sys import os AWS_REGIONS = [ 'us-east-2' ] for region in AWS_REGIONS: os.environ['AWS_DEFAULT_REGION'] = region try: aws_braket_devices = AwsDevice.get_devices(statuses=['ONLINE'], order_by='provider_name') except Exception as exception: exc_type, value, traceback = sys.exc_info() print(f'{exc_type.__name__} calling AwsDevice.get_devices()') raise exception print(f'Creating device objects for AWS Braket ONLINE devices in region {region}') for aws_braket_device in aws_braket_devices: print(f'Creating device obj for {aws_braket_device.arn}...') try: aws_device = AwsDevice(aws_braket_device.arn) except botocore.exceptions.EndpointConnectionError as exc: print(exc) except Exception as exc: print(exc) print(f'device created for {aws_braket_device.arn}') ``` Running this code produces the following output: ``` Creating device objects for AWS Braket ONLINE devices in region us-east-2 Creating device obj for arn:aws:braket:::device/qpu/d-wave/Advantage_system4... Could not connect to the endpoint URL: "https://braket.us-east-2.amazonaws.com/device/arn%3Aaws%3Abraket%3A%3A%3Adevice%2Fqpu%2Fd-wave%2FAdvantage_system4" device created for arn:aws:braket:::device/qpu/d-wave/Advantage_system4 Creating device obj for arn:aws:braket:::device/qpu/d-wave/DW_2000Q_6... Could not connect to the endpoint URL: "https://braket.us-east-2.amazonaws.com/device/arn%3Aaws%3Abraket%3A%3A%3Adevice%2Fqpu%2Fd-wave%2FDW_2000Q_6" device created for arn:aws:braket:::device/qpu/d-wave/DW_2000Q_6 Creating device obj for arn:aws:braket:::device/qpu/ionq/ionQdevice... Could not connect to the endpoint URL: "https://braket.us-east-2.amazonaws.com/device/arn%3Aaws%3Abraket%3A%3A%3Adevice%2Fqpu%2Fionq%2FionQdevice" device created for arn:aws:braket:::device/qpu/ionq/ionQdevice Creating device obj for arn:aws:braket:::device/qpu/rigetti/Aspen-11... Could not connect to the endpoint URL: "https://braket.us-east-2.amazonaws.com/device/arn%3Aaws%3Abraket%3A%3A%3Adevice%2Fqpu%2Frigetti%2FAspen-11" device created for arn:aws:braket:::device/qpu/rigetti/Aspen-11 ``` If the code above is modified to use a region which is a supported service endpoint for AWS Braket (such as `us-east-1`), then the code works as expected. (It is then possible to create device objects for all of the ARNs returned by the `braket.aws.AwsDevice.get_devices()` API) Since it appears that AWS Braket devices cannot be accessed via the `us-east-2` region, it seems like the `braket.aws.AwsDevice.get_devices()` API should be returning an empty list of AWS Braket systems for the `us-east-2` region, and it is not. This API is returning a non-empty list of AWS Braket systems as if they can be reached through the `us-east-2` region when in fact they cannot.
1
answers
0
votes
4
views
asked 4 months ago

Popular users

see all
1/17