Gate-Model Simulator Parameters#

This section describes the configurable parameters you can set on gate-model simulators. The Gate-Model Simulator Properties section gives the properties of these solvers, such as the ranges within which parameter values must be set.

The examples in this section submit the following QCDL program:

from dwave.gate.qcdl import qcdl
from dwave.gate.qcdl.operations import cx, h, measure

@qcdl(2)
def bell_program(q0, q1):
    h(q0)
    cx(q0, q1)
    measure(q0)
    measure(q1)

simulator_job_submission = bell_program()

noise_model#

Boolean flag that applies a noise model.

  • noise_model=True: Apply a noise model.

  • noise_model=False: Do not apply a noise model (simulate an ideal QPU, as described in the About the Simulator section).

The default value is specified by the default_noise_model property.

This example applies a noise model for the program submitted to the simulator.

>>> from dwave.gate.leap import LeapQCDLSimulator
...
>>> simulator = LeapQCDLSimulator()
>>> future = simulator.run(
...     simulator_job_submission,
...     noise_model=True)
>>> result = future.result().result

qpu#

The QPU to simulate, formatted as a string.

The supported_qpu_strings property lists the supported values. The default QPU to simulate is specified by the default_qpu property.

This example submits a QCDL program to a dual-rail QPU simulator with 21 qubits, DRsim_21qubits .

>>> from dwave.gate.leap import LeapQCDLSimulator
...
>>> simulator = LeapQCDLSimulator()
>>> future = simulator.run(
...     simulator_job_submission,
...     qpu='DRsim_21qubits')
>>> result = future.result().result

repeat_until_shots_requested#

Boolean flag to run the circuit repeatedly until a target number of non-erased measurements are accumulated.

Running a circuit might return, under noisy conditions, measurements that are declared to be “erased”, as described in the Measurements section. To try to achieve the required number of non-erasure measurements indicted by the shots parameter, as counted after post-selection to remove “splats” (see the Result Records section), you can select to repeatedly run the circuit. With yield defined as the percentage of shots without erasures, the required number of executions (and runtime) is proportional to the value of the shots parameter and the reciprocal of the yield, and grows exponentially with increased noise.

  • repeat_until_shots_requested=True: Repeatedly run the circuit until the requested number of non-erasure measurements, indicated by the shots parameter, is accumulated with post_select=True. Under noisy conditions the circuit might be executed a greater number of times than set by the shots parameter.

  • repeat_until_shots_requested=False: Run the circuit the number of times set by the shots parameter. Under noisy conditions, fewer non-erasure measurements than indicated by the shots parameter might be accumulated with post_select=True.

The default value is set by the default_repeat_until_shots_requested property.

If runtime exceeds the value you specified in the time_limit parameter (or the default value of the default_time_limit_s property), execution terminates.

This example repeatedly executes the circuit, under noisy conditions, to accumulate 10 non-erasure measurements.

>>> from dwave.gate.leap import LeapQCDLSimulator
...
>>> simulator = LeapQCDLSimulator()
>>> future = simulator.run(
...     simulator_job_submission,
...     shots=10,
...     noise_model=True,
...     repeat_until_shots_requested=True)
>>> result = future.result().result

The sum of non-splat states in the returned results is the requested number of shots:

>>> print(sum(result.get_counts(post_select=True)[0].values()))
10

shots#

The number of measurements to run, formatted as an integer.

Your QCDL program is executed once for each requested measurement.

The specified value must not exceed the value of the maximum_shots property. Execution time is limited by the value you specified in the time_limit parameter (or the default value of the default_time_limit_s property).

The default value is to measure the number of times specified by the default_shots property.

This example executes the circuit 1000 times.

>>> from dwave.gate.leap import LeapQCDLSimulator
...
>>> simulator = LeapQCDLSimulator()
>>> future = simulator.run(
...     simulator_job_submission,
...     shots=1000)
>>> result = future.result().result

time_limit#

Specifies the maximum runtime, in seconds, the solver is allowed to work on the given program. Can be a float or integer.

The specified time must be between the values of the maximum_time_limit_s and minimum_time_limit_s properties.

The default runtime limit is specified by the default_time_limit_s property.

This example sets a maximum runtime of 10 minutes.

>>> from dwave.gate.leap import LeapQCDLSimulator
...
>>> simulator = LeapQCDLSimulator()
>>> future = simulator.run(
...     simulator_job_submission,
...     time_limit=10*60)
>>> result = future.result().result

transpile#

Boolean flag to rewrite the submitted QCDL circuit to use the QPU’s supported basis gates and topology, as described in the Transpilation section.

  • transpile=True: Transpile the circuit.

  • transpile=False: Run the circuit exactly as specified in the submitted QCDL or return an error.

The default value is specified by the default_transpile property.

This example requires that the QCDL circuit be submitted as written to the simulator.

>>> from dwave.gate.leap import LeapQCDLSimulator
...
>>> simulator = LeapQCDLSimulator()
>>> future = simulator.run(
...     simulator_job_submission,
...     noise_model=True,
...     transpile=False)
>>> result = future.result().result