fetchDetails
Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.
Description
Examples
Fetch Details of Quantum Device Provided by AWS
Connect to a remote quantum device through AWS® by specifying the device name as "Lucy"
.
dev = quantum.backend.QuantumDeviceAWS("Lucy")
dev = QuantumDeviceAWS with properties: Name: "Lucy" DeviceARN: "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" Region: "eu-west-2" S3Path: "s3://amazon-braket-mathworks/default"
Retrieve details about the quantum device.
s = fetchDetails(dev)
s = struct with fields: deviceArn: "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" deviceCapabilities: "{"service": {"braketSchemaHeader": {"name"... " deviceName: "Lucy" deviceStatus: "ONLINE" deviceType: "QPU" providerName: "Oxford"
To parse the deviceCapabilities
field in the returned structure,
you can use the jsondecode
function to convert the description string
into another structure.
capabilities = jsondecode(s.deviceCapabilities)
capabilities = struct with fields: service: [1×1 struct] action: [1×1 struct] deviceParameters: [1×1 struct] braketSchemaHeader: [1×1 struct] paradigm: [1×1 struct] provider: [1×1 struct] standardized: [1×1 struct] pulse: [1×1 struct]
The structure returned by fetchDetails
changes from device to
device, and its content may also change over time as provided by the AWS quantum computing services.
Fetch Details of Quantum Task Sent to AWS
Connect to a remote quantum device through AWS by specifying the device name as "Aspen-M-3"
.
dev = quantum.backend.QuantumDeviceAWS("Aspen-M-3")
dev = QuantumDeviceAWS with properties: Name: "Aspen-M-3" DeviceARN: "arn:aws:braket:us-west-1::device/qpu/rigetti/Aspen-M-3" Region: "us-west-1" S3Path: "s3://amazon-braket-mathworks/default"
Create a task to run a quantum circuit on this device. Wait for the task to finish.
gates = [hGate(1); cxGate(1,2)]; c = quantumCircuit(gates); task = run(c,dev); wait(task) task
task = QuantumTaskAWS with properties: TaskARN: "arn:aws:braket:us-west-1:123456789012:quantum-task/12a34b5c-6a78-9a01-2ab3-4c56def7a890" Status: "finished"
Retrieve details about the task.
s = fetchDetails(task)
s = struct with fields: Task: [1×1 struct] Result: [1×1 struct]
Query the Task
and Result
fields of the
returned structure. These fields contain details about the task and the measurement
result of the task.
t = s.Task
t = struct with fields: createdAt: "2023-01-11T00:32:30Z' deviceArn: "arn:aws:braket:us-west-1::device/qpu/rigetti/Aspen-M-3" deviceParameters: "{"braketSchemaHeader": {"name": ... }}" endedAt: "2023-01-11T00:32:32Z" outputS3Bucket: "amazon-braket-mathworks" outputS3Directory: "default/a1b2c3d4-56ab-7bc8-d900-e0000fa1b2c3" quantumTaskArn: "arn:aws:braket:us-west-1:123456789012:quantum-task/12a34b5c-6a78-9a01-2ab3-4c56def7a890" shots: 100 status: "COMPLETED"
r = s.Result
r = struct with fields: braketSchemaHeader: [1×1 struct] measurements: [100×2 double] resultTypes: [1×1 struct] measuredQubits: [2×1 double] taskMetadata: [1×1 struct] additionalMetadata: [1×1 struct]
Fetch Details of Quantum Device Provided by IBM
Connect to a remote quantum device through the IBM®
Qiskit® Runtime Services by specifying the device name as
"ibmq_qasm_simulator"
.
dev = quantum.backend.QuantumDeviceIBM("ibmq_qasm_simulator")
dev = QuantumDeviceIBM with properties: Name: "ibmq_qasm_simulator" AccountName: "<my account name>" UseSession: 0
Retrieve details about the quantum device.
s = fetchDetails(dev)
s = struct with fields: Status: [1×1 struct] Configuration: [1×1 struct] Properties: [1×1 struct] Defaults: [1×1 struct]
To check on the content of one of the fields, you can query into that field. For
example, show the content of the Properties
field.
s.Properties
ans = struct with fields: backend_name: 'ibmq_qasm_simulator' backend_version: '1.2.11' gates: [33×1 struct] general: [8×1 struct] last_update_date: '2023-08-29T04:40:11Z' qubits: [5×8 struct]
The structure returned by fetchDetails
changes from device to
device, and its content may also change over time as provided by IBM.
Fetch Details of Quantum Task Sent to IBM
Connect to a remote quantum device through IBM Qiskit Runtime Services by specifying the device name as
"ibmq_qasm_simulator"
.
dev = quantum.backend.QuantumDeviceIBM("ibmq_qasm_simulator")
dev = QuantumDeviceIBM with properties: Name: "ibmq_qasm_simulator" AccountName: "<my account name>" UseSession: 0
Create a task to run a quantum circuit on this device. Wait for the task to finish.
gates = [hGate(1); cxGate(1,2)]; c = quantumCircuit(gates); task = run(c,dev); wait(task) task
task = QuantumTaskIBM with properties: TaskID: "123abcd4efa5bcdef678" SessionID: <missing> AccountName: "<my account name>" Status: "queued"
Retrieve details about the task.
s = fetchDetails(task)
s = struct with fields: Task: [1×1 struct] Result: [1×1 struct]
Query the Task
and Result
fields of the
returned structure. These fields contain details about the task and the measurement
result of the task.
t = s.Task
t = struct with fields: id: '123abcd4efa5bcdef678' hub: 'ibm-q' group: 'open' project: 'main' backend: 'ibmq_qasm_simulator' state: [1×1 struct] params: [1×1 struct] program: [1×1 struct] created: '2023-08-24T18:00:18.6848Z' cost: 3600 remote_storage: [1×1 struct] status: 'Completed'
r = s.Result
r = struct with fields: quasi_dists: [1×1 struct] metadata: [1×1 struct]
The structure returned by fetchDetails
changes from device to
device, and its content may also change over time as provided by IBM.
Input Arguments
devtask
— Quantum device or task
QuantumDeviceAWS
object | QuantumDeviceIBM
object | QuantumTaskAWS
object | QuantumTaskIBM
object
Quantum task or device, specified as a QuantumDeviceAWS
object, a
QuantumDeviceIBM
object, a QuantumTaskAWS
object, or a QuantumTaskIBM
object.
If
devtask
is aQuantumDeviceAWS
object, then the output structures
contains fields provided by AWS.If
devtask
is aQuantumDeviceIBM
object, then the output structures
contains fields provided by IBM.If
devtask
is aQuantumTaskAWS
object, then the output structures
contains the fieldss.Task
for the task information ands.Result
for the task result (if available). Each of these fields is also a structure containing fields provided by AWS.If
devtask
is aQuantumTaskIBM
object, then the output structures
contains the fieldss.Task
for the task information ands.Result
for the task result (if available). Each of these fields is also a structure containing fields provided by IBM.
Version History
Introduced in R2023a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)