13
13
"""Module for interfacing with an IBM Quantum Backend."""
14
14
15
15
import logging
16
- from typing import Union , Optional , Any , List
16
+ from typing import Optional , Any , List
17
17
from datetime import datetime as python_datetime
18
18
from copy import deepcopy
19
19
from packaging .version import Version
36
36
from .api .clients import RuntimeClient
37
37
from .exceptions import (
38
38
IBMBackendApiProtocolError ,
39
- IBMBackendValueError ,
40
39
IBMBackendError ,
41
40
)
42
41
from .utils .backend_converter import convert_to_target
@@ -94,7 +93,6 @@ class IBMBackend(Backend):
94
93
* conditional: backend supports conditional operations.
95
94
* open_pulse: backend supports open pulse.
96
95
* memory: backend supports memory.
97
- * max_shots: (DEPRECATED) maximum number of shots supported.
98
96
* coupling_map (list): The coupling map for the device
99
97
* supported_instructions (List[str]): Instructions supported by the backend.
100
98
* dynamic_reprate_enabled (bool): whether delay between primitives can be set dynamically
@@ -125,7 +123,6 @@ class IBMBackend(Backend):
125
123
[d->u->m] x n_registers. Latency (in units of dt) to do a
126
124
conditional operation on channel n from register slot m
127
125
* meas_map (list): Grouping of measurement which are multiplexed
128
- * max_circuits (int): (DEPRECATED) The maximum number of experiments per job
129
126
* sample_name (str): Sample name for the backend
130
127
* n_registers (int): Number of register slots available for feedback
131
128
(if conditional is True)
@@ -182,16 +179,13 @@ def __init__(
182
179
self ._properties : Any = None
183
180
self ._defaults : Any = None
184
181
self ._target : Any = None
185
- self ._max_circuits = configuration .max_experiments
186
182
if (
187
183
not self ._configuration .simulator
188
184
and hasattr (self .options , "noise_model" )
189
185
and hasattr (self .options , "seed_simulator" )
190
186
):
191
187
self .options .set_validator ("noise_model" , type (None ))
192
188
self .options .set_validator ("seed_simulator" , type (None ))
193
- if hasattr (configuration , "max_shots" ):
194
- self .options .set_validator ("shots" , (1 , configuration .max_shots ))
195
189
if hasattr (configuration , "rep_delay_range" ):
196
190
self .options .set_validator (
197
191
"rep_delay" ,
@@ -210,13 +204,6 @@ def __getattr__(self, name: str) -> Any:
210
204
"'{}' object has no attribute '{}'" .format (self .__class__ .__name__ , name )
211
205
)
212
206
213
- if name in ["max_experiments" , "max_shots" ]:
214
- issue_deprecation_msg (
215
- f"{ name } is deprecated" ,
216
- "0.37.0" ,
217
- "Please see our documentation on job limits "
218
- "https://quantum.cloud.ibm.com/docs/guides/job-limits#job-limits." ,
219
- )
220
207
# Lazy load properties and pulse defaults and construct the target object.
221
208
self .properties ()
222
209
self .defaults ()
@@ -282,20 +269,13 @@ def dtm(self) -> float:
282
269
return self ._configuration .dtm
283
270
284
271
@property
285
- def max_circuits (self ) -> int :
286
- """(DEPRECATED) The maximum number of circuits
287
-
288
- The maximum number of circuits that can be
289
- run in a single job. If there is no limit this will return None.
272
+ def max_circuits (self ) -> None :
273
+ """This property used to return the `max_experiments` value from the
274
+ backend configuration but this value is no longer an accurate representation
275
+ of backend circuit limits. New fields will be added to indicate new limits.
290
276
"""
291
277
292
- issue_deprecation_msg (
293
- "max_circuits is deprecated" ,
294
- "0.37.0" ,
295
- "Please see our documentation on job limits "
296
- "https://quantum.cloud.ibm.com/docs/guides/job-limits#job-limits." ,
297
- )
298
- return self ._max_circuits
278
+ return None
299
279
300
280
@property
301
281
def meas_map (self ) -> List [List [int ]]:
@@ -489,26 +469,6 @@ def __call__(self) -> "IBMBackend":
489
469
# For backward compatibility only, can be removed later.
490
470
return self
491
471
492
- def _check_circuits_attributes (self , circuits : List [Union [QuantumCircuit , str ]]) -> None :
493
- """Check that circuits can be executed on backend.
494
- Raises:
495
- IBMBackendValueError:
496
- - If one of the circuits contains more qubits than on the backend."""
497
-
498
- if len (circuits ) > self ._max_circuits :
499
- raise IBMBackendValueError (
500
- f"Number of circuits, { len (circuits )} exceeds the "
501
- f"maximum for this backend, { self ._max_circuits } )"
502
- )
503
- for circ in circuits :
504
- if isinstance (circ , QuantumCircuit ):
505
- if circ .num_qubits > self ._configuration .num_qubits :
506
- raise IBMBackendValueError (
507
- f"Circuit contains { circ .num_qubits } qubits, "
508
- f"but backend has only { self .num_qubits } ."
509
- )
510
- self .check_faulty (circ )
511
-
512
472
def check_faulty (self , circuit : QuantumCircuit ) -> None :
513
473
"""Check if the input circuit uses faulty qubits or edges.
514
474
@@ -557,7 +517,6 @@ def __deepcopy__(self, _memo: dict = None) -> "IBMBackend":
557
517
cpy ._coupling_map = self ._coupling_map
558
518
cpy ._defaults = deepcopy (self ._defaults , _memo )
559
519
cpy ._target = deepcopy (self ._target , _memo )
560
- cpy ._max_circuits = self ._max_circuits
561
520
cpy ._options = deepcopy (self ._options , _memo )
562
521
return cpy
563
522
@@ -640,9 +599,7 @@ def from_name(
640
599
conditional = False ,
641
600
open_pulse = False ,
642
601
memory = False ,
643
- max_shots = 1 ,
644
602
gates = [GateConfig (name = "TODO" , parameters = [], qasm_def = "TODO" )],
645
603
coupling_map = [[0 , 1 ]],
646
- max_experiments = 300 ,
647
604
)
648
605
return cls (configuration , api )
0 commit comments