Quantum Volume (QV)#

%load_ext autoreload
%autoreload 2

Choose (or define) a backend#

#backend = "fakeadonis"
backend = "fakeapollo"
#backend = "garnet"
#backend = "deneb"

Set IQM Token if using Resonance.#

# import os
# os.environ["IQM_TOKEN"] = ""

Quantum Volume Configuration#

from iqm.benchmarks.quantum_volume.quantum_volume import *
EXAMPLE_QV = QuantumVolumeConfiguration(
    num_circuits=500,
    shots=2**8,
    calset_id=None,
    num_sigmas=2,
    choose_qubits_routine="custom",
    custom_qubits_array=[[0,1,2,3], [0,1,3,4]],
    qiskit_optim_level=3,
    optimize_sqg=True,
    routing_method="sabre",
    physical_layout="fixed",
    max_gates_per_batch=60_000,
    rem=True,
    mit_shots=1_000,
)

Run the experiment#

benchmark_qv = QuantumVolumeBenchmark(backend, EXAMPLE_QV)
run0_qv = benchmark_qv.run()
2025-01-09 17:34:00,453 - iqm.benchmarks.logging_config - INFO - Executing QV on qubits [0, 1, 2, 3]
2025-01-09 17:34:00,780 - iqm.benchmarks.logging_config - INFO - Successfully generated all 500 circuits to be executed
2025-01-09 17:34:00,780 - iqm.benchmarks.logging_config - INFO - Will transpile according to "fixed" physical layout
2025-01-09 17:34:00,781 - iqm.benchmarks.logging_config - INFO - Transpiling for backend IQMFakeApolloBackend with optimization level 3, sabre routing method and SQG optimization all circuits
2025-01-09 17:34:12,196 - iqm.benchmarks.logging_config - INFO - Submitting batch with 500 circuits corresponding to qubits [0, 1, 2, 3]
2025-01-09 17:34:12,210 - iqm.benchmarks.logging_config - INFO - max_gates_per_batch restriction: submitting subbatch #1 with 500 circuits corresponding to qubits [0, 1, 2, 3]
2025-01-09 17:34:12,217 - iqm.benchmarks.logging_config - INFO - Job for layout [0, 1, 2, 3] submitted successfully!
2025-01-09 17:34:12,252 - iqm.benchmarks.logging_config - INFO - Executing QV on qubits [0, 1, 3, 4]
2025-01-09 17:34:12,688 - iqm.benchmarks.logging_config - INFO - Successfully generated all 500 circuits to be executed
2025-01-09 17:34:12,757 - iqm.benchmarks.logging_config - INFO - Will transpile according to "fixed" physical layout
2025-01-09 17:34:12,783 - iqm.benchmarks.logging_config - INFO - Transpiling for backend IQMFakeApolloBackend with optimization level 3, sabre routing method and SQG optimization all circuits
2025-01-09 17:34:23,021 - iqm.benchmarks.logging_config - INFO - Submitting batch with 500 circuits corresponding to qubits [0, 1, 3, 4]
2025-01-09 17:34:23,032 - iqm.benchmarks.logging_config - INFO - max_gates_per_batch restriction: submitting subbatch #1 with 500 circuits corresponding to qubits [0, 1, 3, 4]
2025-01-09 17:34:23,033 - iqm.benchmarks.logging_config - INFO - Job for layout [0, 1, 3, 4] submitted successfully!
2025-01-09 17:34:23,050 - iqm.benchmarks.logging_config - INFO - Retrieving all counts for [0, 1, 2, 3]
2025-01-09 17:34:23,082 - iqm.benchmarks.logging_config - INFO - Adding counts of [0, 1, 2, 3] run to the dataset
2025-01-09 17:34:25,283 - iqm.benchmarks.logging_config - INFO - Retrieving all counts for [0, 1, 3, 4]
2025-01-09 17:34:25,290 - iqm.benchmarks.logging_config - INFO - Adding counts of [0, 1, 3, 4] run to the dataset
2025-01-09 17:34:28,088 - iqm.benchmarks.logging_config - INFO - QV experiment execution concluded !

One can perform a separate run of the benchmark (also possible with a different configuration)

#run1_qv = benchmark_qv.run()

Perform Analysis#

result0_qv = benchmark_qv.analyze()
2025-01-09 17:34:28,204 - iqm.benchmarks.logging_config - INFO - Noiseless simulation and post-processing for layout [0, 1, 2, 3]
2025-01-09 17:34:29,111 - iqm.benchmarks.logging_config - INFO - Noiseless simulation and post-processing for layout [0, 1, 3, 4]
2025-01-09 17:34:29,806 - iqm.benchmarks.logging_config - INFO - REM post-processing for layout [0, 1, 2, 3] with 1000 shots
2025-01-09 17:34:29,837 - iqm.benchmarks.logging_config - INFO - REM post-processing for layout [0, 1, 3, 4] with 1000 shots
#result1_qv = benchmark.analyze(run_index=0)

List all the keys in the attributes of the dataset

attr_keys = sorted([str(x) for x in list(result0_qv.dataset.attrs.keys())])
for k in attr_keys:
    print(k)
0
1
REM_quasidistributions
backend_configuration_name
backend_name
benchmark
calset_id
choose_qubits_routine
custom_qubits_array
execution_timestamp
max_gates_per_batch
mit_shots
num_circuits
num_sigmas
optimize_sqg
physical_layout
qiskit_optim_level
rem
routing_method
session_timestamp
shots

The data for specific experiments is indexed by 0,1,…, e.g., for the first experiment:

for k in result0_qv.dataset.attrs[0].keys():
    print(k)
qubits
qv_results_type
time_circuit_generation
time_transpilation
time_batching
time_submit
time_retrieve
all_job_metadata
operation_counts
cumulative_average_heavy_output_probability
cumulative_stddev_heavy_output_probability
heavy_output_probabilities
REM_cumulative_average_heavy_output_probability
REM_cumulative_stddev_heavy_output_probability
REM_heavy_output_probabilities
result0_qv.dataset.attrs[0]["heavy_output_probabilities"]
[0.60546875,
 0.71875,
 0.578125,
 0.74609375,
 0.6328125,
 0.546875,
 0.56640625,
 0.76953125,
 0.75390625,
 0.67578125,
 0.6171875,
 0.55078125,
 0.56640625,
 0.64453125,
 0.6875,
 0.64453125,
 0.7109375,
 0.82421875,
 0.76171875,
 0.546875,
 0.6484375,
 0.6015625,
 0.73828125,
 0.67578125,
 0.63671875,
 0.69140625,
 0.61328125,
 0.625,
 0.734375,
 0.57421875,
 0.6953125,
 0.55859375,
 0.69921875,
 0.609375,
 0.6328125,
 0.671875,
 0.60546875,
 0.6171875,
 0.77734375,
 0.6796875,
 0.62890625,
 0.6328125,
 0.6640625,
 0.62890625,
 0.66796875,
 0.62109375,
 0.64453125,
 0.703125,
 0.6640625,
 0.62890625,
 0.68359375,
 0.6328125,
 0.64453125,
 0.58984375,
 0.71484375,
 0.62109375,
 0.59375,
 0.6484375,
 0.59375,
 0.578125,
 0.6484375,
 0.79296875,
 0.59375,
 0.59375,
 0.62890625,
 0.66015625,
 0.6796875,
 0.62109375,
 0.61328125,
 0.609375,
 0.65234375,
 0.59765625,
 0.578125,
 0.60546875,
 0.60546875,
 0.734375,
 0.65625,
 0.59375,
 0.62890625,
 0.84765625,
 0.6953125,
 0.57421875,
 0.5859375,
 0.58984375,
 0.5625,
 0.72265625,
 0.640625,
 0.58203125,
 0.69921875,
 0.65625,
 0.63671875,
 0.72265625,
 0.69140625,
 0.54296875,
 0.578125,
 0.64453125,
 0.703125,
 0.59375,
 0.63671875,
 0.62890625,
 0.6640625,
 0.6875,
 0.640625,
 0.62109375,
 0.65625,
 0.62890625,
 0.63671875,
 0.65625,
 0.8203125,
 0.578125,
 0.5625,
 0.78515625,
 0.72265625,
 0.55859375,
 0.7265625,
 0.62890625,
 0.62890625,
 0.578125,
 0.63671875,
 0.65234375,
 0.53515625,
 0.5703125,
 0.625,
 0.61328125,
 0.6328125,
 0.578125,
 0.63671875,
 0.578125,
 0.5703125,
 0.62109375,
 0.671875,
 0.69140625,
 0.5546875,
 0.65625,
 0.65625,
 0.63671875,
 0.703125,
 0.5859375,
 0.671875,
 0.79296875,
 0.71484375,
 0.625,
 0.65234375,
 0.65625,
 0.5390625,
 0.63671875,
 0.625,
 0.76953125,
 0.609375,
 0.828125,
 0.875,
 0.80859375,
 0.6171875,
 0.765625,
 0.59765625,
 0.75390625,
 0.7109375,
 0.82421875,
 0.62109375,
 0.69921875,
 0.6015625,
 0.59375,
 0.66796875,
 0.71484375,
 0.6171875,
 0.578125,
 0.609375,
 0.6484375,
 0.5703125,
 0.5625,
 0.671875,
 0.54296875,
 0.62109375,
 0.7109375,
 0.72265625,
 0.78515625,
 0.609375,
 0.6171875,
 0.71875,
 0.81640625,
 0.5625,
 0.5234375,
 0.62890625,
 0.62890625,
 0.6015625,
 0.59375,
 0.6875,
 0.75,
 0.61328125,
 0.6484375,
 0.58203125,
 0.578125,
 0.62890625,
 0.63671875,
 0.66796875,
 0.76953125,
 0.60546875,
 0.6015625,
 0.6015625,
 0.73046875,
 0.6171875,
 0.6328125,
 0.64453125,
 0.609375,
 0.87890625,
 0.6328125,
 0.7265625,
 0.671875,
 0.60546875,
 0.6015625,
 0.76953125,
 0.6328125,
 0.68359375,
 0.64453125,
 0.609375,
 0.5625,
 0.5859375,
 0.59375,
 0.64453125,
 0.62109375,
 0.58203125,
 0.6796875,
 0.66796875,
 0.6640625,
 0.703125,
 0.671875,
 0.57421875,
 0.7109375,
 0.75390625,
 0.7890625,
 0.67578125,
 0.60546875,
 0.61328125,
 0.58984375,
 0.65625,
 0.59765625,
 0.81640625,
 0.60546875,
 0.59375,
 0.61328125,
 0.64453125,
 0.62109375,
 0.7734375,
 0.62109375,
 0.66796875,
 0.72265625,
 0.625,
 0.66015625,
 0.640625,
 0.5859375,
 0.68359375,
 0.6875,
 0.6953125,
 0.6953125,
 0.7265625,
 0.625,
 0.65234375,
 0.6796875,
 0.6015625,
 0.55078125,
 0.6171875,
 0.63671875,
 0.61328125,
 0.59375,
 0.59375,
 0.6328125,
 0.609375,
 0.609375,
 0.7421875,
 0.59765625,
 0.609375,
 0.70703125,
 0.578125,
 0.5625,
 0.73046875,
 0.6875,
 0.65625,
 0.640625,
 0.69140625,
 0.67578125,
 0.58984375,
 0.71875,
 0.6640625,
 0.59375,
 0.59765625,
 0.6796875,
 0.6328125,
 0.71484375,
 0.60546875,
 0.6484375,
 0.60546875,
 0.70703125,
 0.5546875,
 0.7265625,
 0.6640625,
 0.61328125,
 0.765625,
 0.6328125,
 0.66015625,
 0.65625,
 0.69921875,
 0.69140625,
 0.64453125,
 0.7890625,
 0.65234375,
 0.64453125,
 0.61328125,
 0.7734375,
 0.62890625,
 0.7109375,
 0.625,
 0.671875,
 0.57421875,
 0.59765625,
 0.6484375,
 0.6796875,
 0.5859375,
 0.7109375,
 0.59375,
 0.640625,
 0.625,
 0.60546875,
 0.63671875,
 0.62109375,
 0.59765625,
 0.6640625,
 0.65625,
 0.63671875,
 0.65234375,
 0.5703125,
 0.59375,
 0.75,
 0.58984375,
 0.61328125,
 0.6953125,
 0.62890625,
 0.6328125,
 0.59375,
 0.65625,
 0.61328125,
 0.6875,
 0.6328125,
 0.66015625,
 0.7265625,
 0.65625,
 0.625,
 0.64453125,
 0.6953125,
 0.57421875,
 0.55859375,
 0.65234375,
 0.6875,
 0.59765625,
 0.58984375,
 0.6875,
 0.66796875,
 0.64453125,
 0.62890625,
 0.60546875,
 0.67578125,
 0.5625,
 0.65234375,
 0.59765625,
 0.56640625,
 0.6796875,
 0.703125,
 0.66015625,
 0.62890625,
 0.67578125,
 0.65234375,
 0.59765625,
 0.57421875,
 0.6328125,
 0.72265625,
 0.65234375,
 0.6171875,
 0.73046875,
 0.75,
 0.6640625,
 0.62890625,
 0.5390625,
 0.57421875,
 0.67578125,
 0.609375,
 0.6640625,
 0.671875,
 0.58203125,
 0.6796875,
 0.6796875,
 0.71484375,
 0.625,
 0.53515625,
 0.765625,
 0.53515625,
 0.62109375,
 0.70703125,
 0.6328125,
 0.6796875,
 0.61328125,
 0.7734375,
 0.640625,
 0.61328125,
 0.58984375,
 0.6015625,
 0.703125,
 0.5703125,
 0.62109375,
 0.68359375,
 0.74609375,
 0.78515625,
 0.69921875,
 0.62109375,
 0.62109375,
 0.75,
 0.609375,
 0.61328125,
 0.671875,
 0.6640625,
 0.6484375,
 0.6484375,
 0.578125,
 0.56640625,
 0.66015625,
 0.64453125,
 0.69140625,
 0.65625,
 0.58984375,
 0.53515625,
 0.6484375,
 0.61328125,
 0.50390625,
 0.625,
 0.6484375,
 0.62890625,
 0.640625,
 0.65625,
 0.671875,
 0.75,
 0.75,
 0.56640625,
 0.5859375,
 0.69140625,
 0.55859375,
 0.6328125,
 0.67578125,
 0.6484375,
 0.63671875,
 0.8203125,
 0.60546875,
 0.5625,
 0.72265625,
 0.53515625,
 0.7109375,
 0.67578125,
 0.73828125,
 0.6015625,
 0.5703125,
 0.609375,
 0.69921875,
 0.7578125,
 0.52734375,
 0.609375,
 0.62890625,
 0.78125,
 0.75,
 0.59375,
 0.67578125,
 0.58203125,
 0.578125,
 0.625,
 0.74609375,
 0.5859375,
 0.6328125,
 0.66015625,
 0.69921875,
 0.7265625,
 0.55859375,
 0.6328125,
 0.546875,
 0.75390625,
 0.62109375,
 0.64453125,
 0.8203125,
 0.6015625,
 0.6015625,
 0.640625,
 0.65234375,
 0.65234375,
 0.65625,
 0.765625,
 0.6171875,
 0.75,
 0.75390625,
 0.671875,
 0.58203125,
 0.8125,
 0.63671875,
 0.6328125,
 0.69921875,
 0.6328125]

The observation object contains the benchmark results

result0_qv.observations
[BenchmarkObservation(name='average_heavy_output_probability', value=0.649203125, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 2, 3]), uncertainty=0.021341903733745705),
 BenchmarkObservation(name='is_succesful', value=False, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 2, 3]), uncertainty=None),
 BenchmarkObservation(name='QV_result', value=1, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 2, 3]), uncertainty=None),
 BenchmarkObservation(name='average_heavy_output_probability', value=0.672703125, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 3, 4]), uncertainty=0.020984452845629994),
 BenchmarkObservation(name='is_succesful', value=False, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 3, 4]), uncertainty=None),
 BenchmarkObservation(name='QV_result', value=1, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 3, 4]), uncertainty=None),
 BenchmarkObservation(name='REM_average_heavy_output_probability', value=0.67954478782619, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 2, 3]), uncertainty=0.020869291754367154),
 BenchmarkObservation(name='REM_is_succesful', value=False, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 2, 3]), uncertainty=None),
 BenchmarkObservation(name='REM_QV_result', value=1, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 2, 3]), uncertainty=None),
 BenchmarkObservation(name='REM_average_heavy_output_probability', value=0.710149650958595, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 3, 4]), uncertainty=0.020289757228807877),
 BenchmarkObservation(name='REM_is_succesful', value=True, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 3, 4]), uncertainty=None),
 BenchmarkObservation(name='REM_QV_result', value=16, identifier=BenchmarkObservationIdentifier(qubit_indices=[0, 1, 3, 4]), uncertainty=None)]

Generate plots#

for k in result0_qv.plots.keys():
    print(k)
vanilla_4_qubits_[0, 1, 2, 3]
vanilla_4_qubits_[0, 1, 3, 4]
vanilla_REM_4_qubits_[0, 1, 2, 3]
vanilla_REM_4_qubits_[0, 1, 3, 4]

Print a specific output

# result0_qv.plots["vanilla_4_qubits_[0, 1, 3, 4]"]

Or print all the plots at once

result0_qv.plot_all()
../_images/f0cb0abc423ccc6ef7302cf46e7a5788d92aa654e1404abb225db21f75661b9b.png ../_images/aa87b1775ce19a699a9490b372fe3ca51bce07d77cabab791bc0b7cfb4aa5946.png ../_images/46a491bd496e73f18d145a2d3e096a72514a8d6465bb9f081c71869fa5f5e9ec.png ../_images/b0550871376a822b40c454b9427d60770332126c49892d533ae0874e6c7dc05f.png