iqm-client 29.7.0__py3-none-any.whl → 29.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- iqm/cirq_iqm/examples/demo_iqm_execution.py +3 -3
- iqm/qiskit_iqm/iqm_provider.py +36 -15
- {iqm_client-29.7.0.dist-info → iqm_client-29.9.0.dist-info}/METADATA +1 -1
- {iqm_client-29.7.0.dist-info → iqm_client-29.9.0.dist-info}/RECORD +9 -9
- {iqm_client-29.7.0.dist-info → iqm_client-29.9.0.dist-info}/AUTHORS.rst +0 -0
- {iqm_client-29.7.0.dist-info → iqm_client-29.9.0.dist-info}/LICENSE.txt +0 -0
- {iqm_client-29.7.0.dist-info → iqm_client-29.9.0.dist-info}/WHEEL +0 -0
- {iqm_client-29.7.0.dist-info → iqm_client-29.9.0.dist-info}/entry_points.txt +0 -0
- {iqm_client-29.7.0.dist-info → iqm_client-29.9.0.dist-info}/top_level.txt +0 -0
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
"""Demonstrates executing a quantum circuit on an IQM quantum computer.
|
|
15
15
|
|
|
16
16
|
Set the STATION_CONTROL_URL environment variable before running this script.
|
|
17
|
-
Also, if the server you are running against requires authentication you will also have to
|
|
18
|
-
|
|
17
|
+
Also, if the server you are running against requires authentication you will also have to use
|
|
18
|
+
the IQM_TOKENS_FILE or the IQM_TOKEN variable to set the access token.
|
|
19
19
|
|
|
20
20
|
E.g.
|
|
21
21
|
|
|
22
22
|
export STATION_CONTROL_URL="https://example.com/station"
|
|
23
|
-
export IQM_AUTH_SERVER="https://example.com/auth"
|
|
24
23
|
export IQM_TOKENS_FILE="/path/to/my/tokens.json"
|
|
24
|
+
export IQM_TOKEN="<token here>"
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
import os
|
iqm/qiskit_iqm/iqm_provider.py
CHANGED
|
@@ -21,9 +21,17 @@ from typing import Any
|
|
|
21
21
|
from uuid import UUID
|
|
22
22
|
import warnings
|
|
23
23
|
|
|
24
|
-
from iqm.iqm_client import
|
|
24
|
+
from iqm.iqm_client import (
|
|
25
|
+
Circuit,
|
|
26
|
+
CircuitCompilationOptions,
|
|
27
|
+
CircuitValidationError,
|
|
28
|
+
IQMClient,
|
|
29
|
+
RunRequest,
|
|
30
|
+
)
|
|
25
31
|
from iqm.iqm_client.util import to_json_dict
|
|
32
|
+
from iqm.qiskit_iqm import IQMFakeAphrodite, IQMFakeApollo, IQMFakeDeneb
|
|
26
33
|
from iqm.qiskit_iqm.fake_backends import IQMFakeAdonis
|
|
34
|
+
from iqm.qiskit_iqm.fake_backends.fake_garnet import IQMFakeGarnet
|
|
27
35
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
28
36
|
from iqm.qiskit_iqm.iqm_job import IQMJob
|
|
29
37
|
from iqm.qiskit_iqm.qiskit_to_iqm import serialize_instructions
|
|
@@ -257,26 +265,31 @@ class IQMBackend(IQMBackendBase):
|
|
|
257
265
|
return Circuit(name=circuit.name, instructions=instructions, metadata=metadata)
|
|
258
266
|
|
|
259
267
|
|
|
268
|
+
facade_names = {
|
|
269
|
+
"facade_adonis": IQMFakeAdonis(),
|
|
270
|
+
"facade_aphrodite": IQMFakeAphrodite(),
|
|
271
|
+
"facade_apollo": IQMFakeApollo(),
|
|
272
|
+
"facade_deneb": IQMFakeDeneb(),
|
|
273
|
+
"facade_garnet": IQMFakeGarnet(),
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
|
|
260
277
|
class IQMFacadeBackend(IQMBackend):
|
|
261
|
-
"""
|
|
262
|
-
|
|
263
|
-
|
|
278
|
+
"""Simulates the execution of quantum circuits on a mock IQM quantum computer.
|
|
279
|
+
|
|
280
|
+
Can be used to submit a circuit to a mock IQM server that has no real quantum hardware,
|
|
281
|
+
and if the mock execution is successful, simulates the circuit locally using an error model that
|
|
282
|
+
is representative of the mocked QPU. Finally returns the simulated results.
|
|
264
283
|
|
|
265
284
|
Args:
|
|
266
|
-
client:
|
|
267
|
-
**kwargs:
|
|
285
|
+
client: Client instance for communicating with an IQM server.
|
|
286
|
+
**kwargs: Optional arguments to be passed to the parent class.
|
|
268
287
|
|
|
269
288
|
"""
|
|
270
289
|
|
|
271
290
|
def __init__(self, client: IQMClient, **kwargs):
|
|
272
|
-
self.fake_adonis = IQMFakeAdonis()
|
|
273
|
-
target_architecture = client.get_static_quantum_architecture()
|
|
274
|
-
|
|
275
|
-
if not self.fake_adonis.validate_compatible_architecture(target_architecture):
|
|
276
|
-
raise ValueError("Quantum architecture of the remote quantum computer does not match Adonis.")
|
|
277
|
-
|
|
278
291
|
super().__init__(client, **kwargs)
|
|
279
|
-
self.
|
|
292
|
+
self.backend = self._determine_facade_backend_from_sqa()
|
|
280
293
|
|
|
281
294
|
def _validate_no_empty_cregs(self, circuit: QuantumCircuit) -> bool:
|
|
282
295
|
"""Returns True if given circuit has no empty (unused) classical registers, False otherwise."""
|
|
@@ -289,6 +302,12 @@ class IQMFacadeBackend(IQMBackend):
|
|
|
289
302
|
return False
|
|
290
303
|
return True
|
|
291
304
|
|
|
305
|
+
def _determine_facade_backend_from_sqa(self) -> IQMFacadeBackend:
|
|
306
|
+
for backend in facade_names.values():
|
|
307
|
+
if backend.validate_compatible_architecture(self.client.get_static_quantum_architecture()):
|
|
308
|
+
return backend
|
|
309
|
+
raise ValueError("Quantum architecture of the remote quantum computer does not match facade input.")
|
|
310
|
+
|
|
292
311
|
def run(self, run_input: QuantumCircuit | list[QuantumCircuit], **options) -> JobV1:
|
|
293
312
|
circuits = [run_input] if isinstance(run_input, QuantumCircuit) else run_input
|
|
294
313
|
circuits_validated_cregs: list[bool] = [self._validate_no_empty_cregs(circuit) for circuit in circuits]
|
|
@@ -302,7 +321,7 @@ class IQMFacadeBackend(IQMBackend):
|
|
|
302
321
|
iqm_backend_job.result() # get and discard results
|
|
303
322
|
if iqm_backend_job.status() == JobStatus.ERROR:
|
|
304
323
|
raise RuntimeError("Remote execution did not succeed.")
|
|
305
|
-
return self.
|
|
324
|
+
return self.backend.run(run_input, **options)
|
|
306
325
|
|
|
307
326
|
|
|
308
327
|
class IQMProvider:
|
|
@@ -336,7 +355,9 @@ class IQMProvider:
|
|
|
336
355
|
client = IQMClient(self.url, **self.user_auth_args)
|
|
337
356
|
|
|
338
357
|
if name and name.startswith("facade_"):
|
|
339
|
-
if name
|
|
358
|
+
if name in facade_names:
|
|
359
|
+
if not facade_names[name].validate_compatible_architecture(client.get_static_quantum_architecture()):
|
|
360
|
+
raise ValueError("Quantum architecture of the remote quantum computer does not match facade input.")
|
|
340
361
|
return IQMFacadeBackend(client)
|
|
341
362
|
|
|
342
363
|
warnings.warn(f"Unknown facade backend: {name}. A regular backend associated with {self.url} will be used.")
|
|
@@ -15,7 +15,7 @@ iqm/cirq_iqm/devices/iqm_device_metadata.py,sha256=-6qnPa8Pp68ruYMzfHO_dlSDvakO2
|
|
|
15
15
|
iqm/cirq_iqm/examples/demo_adonis.py,sha256=rPd8VYqccYijG6t92hfvKsk8RAaMGHOmm4JelYjt3rw,1728
|
|
16
16
|
iqm/cirq_iqm/examples/demo_apollo.py,sha256=vnDwcEXqEyew0cf4SDDQ2budP-giizSNJU3dgOw15H0,1751
|
|
17
17
|
iqm/cirq_iqm/examples/demo_common.py,sha256=l47o574xzIo8Ri5j-RGjY2NRNJN4IU6d6l0dcwDWRtM,8731
|
|
18
|
-
iqm/cirq_iqm/examples/demo_iqm_execution.py,sha256=
|
|
18
|
+
iqm/cirq_iqm/examples/demo_iqm_execution.py,sha256=I9hh1DfveBky-ngJlLmuxucIzlGtRPwrI7sMUSro8eM,2463
|
|
19
19
|
iqm/cirq_iqm/examples/usage.ipynb,sha256=Kyfyu_MwqzTavHVNjgrWJo1tZPeJwTw7ExcU0MFYNRk,34208
|
|
20
20
|
iqm/iqm_client/__init__.py,sha256=D-8W54EcQIxk_1JZo_86GYlR1YitHhPIiFwwLJ2IfGE,1411
|
|
21
21
|
iqm/iqm_client/api.py,sha256=_c6OVuv2dyzBF7J2XlK_qxisTSPyOiI4gYokZPsuaJY,3083
|
|
@@ -39,7 +39,7 @@ iqm/qiskit_iqm/iqm_circuit_validation.py,sha256=vE5CNyJOQ7OMRpQV-xsO1uf_NNFE8v6-
|
|
|
39
39
|
iqm/qiskit_iqm/iqm_job.py,sha256=_JF2DANalsRu4b0r-XxMmTNOqmaShjp1rmU7h44DKRo,11466
|
|
40
40
|
iqm/qiskit_iqm/iqm_move_layout.py,sha256=pHqV1G4bri3rFEsMBN6FrtQ0FXVNQG-Ymm4v7zdnilQ,10787
|
|
41
41
|
iqm/qiskit_iqm/iqm_naive_move_pass.py,sha256=HoLPgkRK7X2g8KM2ML5-rggNE5HIfGEzq4vkthYSPyg,12398
|
|
42
|
-
iqm/qiskit_iqm/iqm_provider.py,sha256=
|
|
42
|
+
iqm/qiskit_iqm/iqm_provider.py,sha256=TjrpZZIAI2_K3pWG6sn30M3jFfEDAWp64_4pDis0OU8,16589
|
|
43
43
|
iqm/qiskit_iqm/iqm_transpilation.py,sha256=2bwvVd8NwBRU6gwlPOsovhyAmUnm8thKokvkuCwfWC8,8915
|
|
44
44
|
iqm/qiskit_iqm/move_gate.py,sha256=QU9RKKVvbGq33qcIi9AKLcvQVQMibkgW4ibjzk-oVy4,2808
|
|
45
45
|
iqm/qiskit_iqm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -56,10 +56,10 @@ iqm/qiskit_iqm/fake_backends/fake_apollo.py,sha256=eT2vd3kQBi1rrvxCpePymBCfFK84d
|
|
|
56
56
|
iqm/qiskit_iqm/fake_backends/fake_deneb.py,sha256=RzQXmLXmBARDiMKVxk5Aw9fVbc6IYlW0A5jibk9iYD0,3156
|
|
57
57
|
iqm/qiskit_iqm/fake_backends/fake_garnet.py,sha256=GI0xafTCj1Um09qVuccO6GPOGBm6ygul_O40Wu220Ys,5555
|
|
58
58
|
iqm/qiskit_iqm/fake_backends/iqm_fake_backend.py,sha256=wJtfsxjPYbDKmzaz5R4AuaXvvPHa21WyPtRgNctL9eY,16785
|
|
59
|
-
iqm_client-29.
|
|
60
|
-
iqm_client-29.
|
|
61
|
-
iqm_client-29.
|
|
62
|
-
iqm_client-29.
|
|
63
|
-
iqm_client-29.
|
|
64
|
-
iqm_client-29.
|
|
65
|
-
iqm_client-29.
|
|
59
|
+
iqm_client-29.9.0.dist-info/AUTHORS.rst,sha256=qsxeK5A3-B_xK3hNbhFHEIkoHNpo7sdzYyRTs7Bdtm8,795
|
|
60
|
+
iqm_client-29.9.0.dist-info/LICENSE.txt,sha256=2DXrmQtVVUV9Fc9RBFJidMiTEaQlG2oAtlC9PMrEwTk,11333
|
|
61
|
+
iqm_client-29.9.0.dist-info/METADATA,sha256=nk6c2OpBQlMAuR1Vt8IuSn3KdF_H1VtM_LXpOMH2-WI,17590
|
|
62
|
+
iqm_client-29.9.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
|
|
63
|
+
iqm_client-29.9.0.dist-info/entry_points.txt,sha256=Kk2qfRwk8vbIJ7qCAvmaUogfRRn6t92_hBFhe6kqAE4,1317
|
|
64
|
+
iqm_client-29.9.0.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
|
|
65
|
+
iqm_client-29.9.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|