### Install base IQM Client library Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/readme.md Example showing how to install only the base IQM Client library from PyPI using uv. ```bash $ uv pip install iqm-client ``` -------------------------------- ### Install IQM Client with Qiskit and Cirq adapters Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/readme.md Example showing how to install the IQM Client with optional Qiskit and Cirq adapters from PyPI using uv. ```bash $ uv pip install "iqm-client[qiskit,cirq]" ``` -------------------------------- ### Installation Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md Installs the optional qiskit feature of the iqm-client distribution package. ```bash $ pip install "iqm-client[qiskit]" ``` -------------------------------- ### Installation Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_cirq.md Install the optional cirq feature of the iqm-client distribution package. ```bash $ pip install "iqm-client[cirq]" ``` -------------------------------- ### Build the site locally in development mode Source: https://github.com/iqm-finland/sdk/blob/main/docs/README.md Commands to install npm dependencies and start the development server. ```bash npm install npm run dev ``` -------------------------------- ### Install optional dependencies Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/README.md This command installs optional dependencies for IQM Benchmarks, including 'mgst' for compressive gate set tomography and 'examples' for Jupyter notebooks. ```sh uv pip install "iqm-benchmarks[mgst,examples]" ``` -------------------------------- ### Creating TimeBoxes Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/using_builder.md Example of getting GateImplementations for standard gates and their equivalent shortcuts. ```python qubits = ["QB1", "QB3"] cz_gate_impl = builder.get_implementation("cz", qubits) prx_gate_impl = builder.get_implementation("prx", ["QB1"]) measure_gate_impl = builder.get_implementation("measure", qubits) # equivalent shortcuts: cz_gate_impl = builder.cz(qubits) prx_gate_impl = builder.prx(["QB1"]) measure_gate_impl = builder.measure(qubits) ``` -------------------------------- ### Example SDK file for a new version Source: https://github.com/iqm-finland/sdk/blob/main/docs/README.md An example of an SDK file (sdk5_0.txt) listing package dependencies and versions. ```text # Example: sdk5_0.txt iqm-pulla[qiskit,qir]==12.0 iqm-client[qiskit,cirq,cli]==35.0 iqm-pulse==15.0 iqm-data-definitions==8.0 ``` -------------------------------- ### Running a circuit with a facade backend Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md This example demonstrates how to use the `IQMFacadeBackend` to run a quantum circuit, combining mock remote execution with local noisy simulation. ```python from qiskit import transpile, QuantumCircuit from iqm.qiskit_iqm import IQMProvider circuit = QuantumCircuit(2) circuit.h(0) circuit.cx(0, 1) circuit.measure_all() iqm_server_url = "https://resonance.iqm.tech" quantum_computer = "garnet:mock" # Replace this with the correct mock env name provider = IQMProvider(iqm_server_url, quantum_computer=quantum_computer) backend = provider.get_backend('facade_garnet') transpiled_circuit = transpile(circuit, backend=backend) job = backend.run(transpiled_circuit, shots=1000) print(job.result().get_counts()) ``` -------------------------------- ### Run Quantum Volume Benchmark (commented out) Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/examples/example_quantum_volume.ipynb An example of how to run the benchmark again, potentially with a different configuration. ```python #run1_qv = benchmark_qv.run() ``` -------------------------------- ### Install the latest release of IQM Benchmarks Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/README.md After activating the virtual environment, this command installs the iqm-benchmarks package using uv. ```sh uv pip install iqm-benchmarks ``` -------------------------------- ### Running a circuit with heralding measurements Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md Example demonstrating how to enable heralding measurements using `circuit_compilation_options` when running a transpiled circuit. ```python from iqm.iqm_client import CircuitCompilationOptions job = backend.run(transpiled_circuit, shots=1000, circuit_compilation_options=CircuitCompilationOptions(heralding_mode=HeraldingMode.ZEROS)) ``` -------------------------------- ### Example Results Source: https://github.com/iqm-finland/sdk/blob/main/iqm_academy_examples/gate/crystal/GarnetQAOA.ipynb Example output showing the top three results for the max cut problem. ```text The top three results are [('10101000', 34), ('01000111', 32), ('01000110', 22)] The maximum cut is given by 01000111 with a cut length of 12 ``` -------------------------------- ### Install necessary packages Source: https://github.com/iqm-finland/sdk/blob/main/iqm_academy_examples/gate/general/DynamicalDecoupling.ipynb Installs the iqm-client with qiskit support and matplotlib for plotting. ```python %%capture !pip install "iqm-client[qiskit]" !pip install matplotlib ``` -------------------------------- ### Install necessary packages Source: https://github.com/iqm-finland/sdk/blob/main/iqm_academy_examples/gate/general/ControlledPRXQiskit.ipynb Installs the required IQM client with Qiskit support. ```python %%capture !pip install -U "iqm-client[qiskit]" ``` -------------------------------- ### Install IQM client with Qiskit support Source: https://github.com/iqm-finland/sdk/blob/main/iqm_academy_examples/gate/general/Lottery.ipynb Install the 'iqm-client[qiskit]' package using pip. ```python !pip install "iqm-client[qiskit]" ``` -------------------------------- ### Install Dependencies Source: https://github.com/iqm-finland/sdk/blob/main/iqm_academy_examples/gate/crystal/braket/GarnetQAOABraket.ipynb Installs the necessary Python packages for the project. ```python !pip install networkx !pip install scipy !pip install amazon-braket-sdk ``` -------------------------------- ### Get channel properties example Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/common_errors.md Example of how to view granularity information for a channel. ```python Pulla.get_channel_properties()[0]['QB1__drive.awg'] ``` -------------------------------- ### Execute Circuit via IQM Server for Comparison Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Quick Start.ipynb Executes the same optimized circuit directly through the IQM Server backend for comparison. ```python # The results should be comparable to a direct circuit execution through IQM Server. print("Executing the same circuit via IQM Server...") job = backend.run(qc_optimized, shots=shots) print(f"Qiskit result counts from IQM Server:\n{job.result().get_counts()}") visualization.plot_histogram(job.result().get_counts()) ``` -------------------------------- ### Environment Setup Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Custom Gates and Implementations.ipynb Imports necessary libraries for quantum circuit manipulation, IQM SDK, and visualization. ```python import os from pprint import pprint from IPython.core.display import HTML import numpy as np import matplotlib.pyplot as plt from dataclasses import dataclass from qiskit import QuantumCircuit from qiskit.compiler import transpile from iqm.qiskit_iqm import IQMProvider from iqm.qiskit_iqm.iqm_transpilation import optimize_single_qubit_gates from iqm.pulla.pulla import Pulla from iqm.pulla.utils_qiskit import qiskit_to_pulla, get_qiskit_compiler from iqm.pulse.gates import PRX_Samples from iqm.pulse.gates.prx import PRX_CustomWaveforms from iqm.pulse.playlist.waveforms import Waveform from iqm.pulse.gate_implementation import CompositeGate from iqm.pulse.quantum_ops import QuantumOp from iqm.pulse.playlist.visualisation.base import inspect_playlist from exa.common.control.sweep.sweep import Sweep from exa.common.control.sweep.option import CenterSpanOptions, StartStopOptions ``` -------------------------------- ### Custom Transpilation Example 1 Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md Example of custom transpilation using transpile_to_IQM with optimization_level=0 and optimize_single_qubits=True. ```python transpile_to_IQM(circuit, backend=backend, optimization_level=0, perform_move_routing=False, optimize_single_qubits=True) ``` -------------------------------- ### Custom Transpilation Example 2 Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md Example of custom transpilation using Qiskit's transpile with optimization_level=0 and scheduling_method='only_rz_optimization'. ```python transpile(circuit, backend=backend, optimization_level=0, scheduling_method='only_rz_optimization') ``` -------------------------------- ### Real backend Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/development/how_to_make_your_own_benchmark.ipynb This code snippet shows how to set up and use a real backend with the IQMProvider, including environment variable configuration for authentication and server URL. ```python from iqm.qiskit_iqm import IQMProvider from iqm.qiskit_iqm.fake_backends.fake_apollo import IQMFakeApollo import os # Real backend # token = "" # os.environ["IQM_TOKEN"] = token # quantum_computer = "garnet" # provide actual quantum computer name # iqm_server_url = "https://resonance.iqm.tech/" # provide actual IQM server URL # os.environ["IQM_SERVER_URL"] = iqm_server_url # # provider = IQMProvider(iqm_server_url, quantum_computer=quantum_computer) ``` -------------------------------- ### Schedule Visualization Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Quick Start.ipynb This snippet demonstrates how to visualize the compiled quantum circuit schedule using IQM Pulse's visualizer. ```python from iqm.pulse.playlist.visualisation.base import inspect_playlist from IPython.core.display import HTML HTML(inspect_playlist(job_definition.sweep_definition.playlist, [0])) ``` -------------------------------- ### Run the QScore Benchmark Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/examples/example_qscore.ipynb Initializes the QScoreBenchmark with the configured backend and QScoreConfiguration, then runs the benchmark. ```python benchmark_qscore = QScoreBenchmark(backend, EXAMPLE_QSCORE) run0_qscore = benchmark_qscore.run() ``` -------------------------------- ### Initialize Pulla and IQM backend Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Example - Randomized Benchmarking.ipynb Sets up the Pulla object and obtains the standard compiler and IQM backend. It requires environment variables for the IQM server URL and authentication token. ```python iqm_server_url = os.environ['PULLA_IQM_SERVER_URL'] # or set the URL directly here os.environ["IQM_TOKEN"] = os.environ.get("IQM_TOKEN") # or set the token directly here" p = Pulla(iqm_server_url=iqm_server_url) compiler = p.get_standard_compiler() provider = IQMProvider(iqm_server_url) backend = provider.get_backend() ``` -------------------------------- ### Import necessary libraries Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Quick Start.ipynb Imports all required modules from Qiskit and IQM Pulla. ```python import os from qiskit import QuantumCircuit, visualization from qiskit.compiler import transpile from iqm.qiskit_iqm import IQMProvider from iqm.qiskit_iqm.iqm_transpilation import optimize_single_qubit_gates from iqm.pulla.pulla import Pulla from iqm.pulla.utils_qiskit import qiskit_to_pulla, sweep_job_to_qiskit ``` -------------------------------- ### Importing Qiskit on IQM Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md Imports Qiskit on IQM in Python code after installation. ```python from iqm import qiskit_iqm ``` -------------------------------- ### Get available qubits Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Example - Measuring T1.ipynb Retrieves the list of available qubits from the compiler's chip topology. ```python qubits = compiler.chip_topology.qubits_sorted qubits ``` -------------------------------- ### Initialize Pulla and IQM Backend Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Quick Start.ipynb Creates a Pulla object and an IQM backend for accessing the quantum computer. ```python # Create a Pulla object and a qiskit-iqm backend for accessing the quantum computer. iqm_server_url = os.environ['PULLA_IQM_SERVER_URL'] # or set the URL directly here os.environ["IQM_TOKEN"] = os.environ.get("IQM_TOKEN") # or set the token directly here p = Pulla(iqm_server_url) provider = IQMProvider(iqm_server_url) backend = provider.get_backend() ``` -------------------------------- ### Configure IQM Provider Source: https://github.com/iqm-finland/sdk/blob/main/iqm_qubit_selector/docs/qubit_selector_example.ipynb Sets up the IQM provider with authentication token and server URL. ```python # Input your Resonance token token = "XXXXXXXX" # Replace with your actual token os.environ["IQM_TOKEN"] = token iqm_server_url = "https://" # Replace with your IQM server URL quantum_computer = "qc_name" # Replace with your quantum computer name if needed provider = IQMProvider(iqm_server_url, quantum_computer = quantum_computer) backend = provider.get_backend() ``` -------------------------------- ### Classically Controlled Gates Example Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md Demonstrates the use of classically controlled gates with `if_test()`. ```python from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister qr = QuantumRegister(2, 'q') cr = ClassicalRegister(1, 'c') circuit = QuantumCircuit(qr, cr) circuit.h(0) circuit.measure(0, cr[0]) with circuit.if_test((cr[0], 1)): circuit.x(1) # apply X gate on qubit 1 if cr[0] is 1 circuit.measure_all() print(circuit.draw(output='text')) ``` -------------------------------- ### Transpile and Optimize Circuit Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Quick Start.ipynb Transpiles the quantum circuit for the IQM backend and optimizes single-qubit gates. ```python qc_transpiled = transpile(qc, backend=backend, layout_method='sabre', optimization_level=3) qc_optimized = optimize_single_qubit_gates(qc_transpiled) qc_optimized.draw(output="mpl") ``` -------------------------------- ### Resetting Qubits Example Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_cirq.md Shows how to use `cirq.R` to reset a qubit to the |0> state. ```Python import cirq q1 = cirq.NamedQubit('q1') circuit = cirq.Circuit(cirq.X(q1), cirq.R(q1), cirq.measure(q1)) circuit ``` ```text q1: ───X───R───M─── ``` -------------------------------- ### Example for creating a new default version Source: https://github.com/iqm-finland/sdk/blob/main/docs/README.md Commands to rename an existing default SDK file and copy a new SDK file to become the new default. ```bash # Rename existing default and create new one mv sdk4_3_default.txt sdk4_3.txt cp sdk5_0.txt sdk5_0_default.txt ``` -------------------------------- ### Circuit Compilation and Execution Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Quick Start.ipynb This snippet shows the process of transpiling a quantum circuit, optimizing it, compiling it using Qiskit to Pulla, submitting the job, and retrieving the results. ```python qc_transpiled = transpile(qc, backend=backend, layout_method='sabre', optimization_level=3) qc_optimized = optimize_single_qubit_gates(qc_transpiled) circuits, compiler = qiskit_to_pulla(p, backend, qc_optimized) pl, context = compiler.compile(circuits) job = p.submit_playlist(pl, context=context) job.wait_for_completion() qiskit_result = sweep_job_to_qiskit(job, shots=shots) print(f"Qiskit result counts:\n{qiskit_result.get_counts()}\n") ``` -------------------------------- ### Resetting Qubits Example Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md Demonstrates resetting a qubit to the |0> state using `circuit.reset(0)`. ```python from qiskit import QuantumCircuit circuit = QuantumCircuit(1, 1) circuit.h(0) circuit.reset(0) circuit.measure(0, 0) print(circuit.draw(output='text')) ``` -------------------------------- ### Using a specific calibration set Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_cirq.md Example of how to instantiate IQMSampler with a specific calibration set ID. ```python sampler = IQMSampler(iqm_server_url, calibration_set_id="f7d9642e-b0ca-4f2d-af2a-30195bd7a76d") ``` -------------------------------- ### Initialize IQM Provider and Pulla Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Example - Simple Dynamical Decoupling.ipynb Sets up the IQM server URL and token, then initializes the IQMProvider and Pulla instances for interacting with the IQM backend. ```python iqm_server_url = os.environ['PULLA_IQM_SERVER_URL'] # or set the URL directly here os.environ["IQM_TOKEN"] = os.environ.get("IQM_TOKEN") # or set the token directly here" provider = IQMProvider(iqm_server_url) backend = provider.get_backend() p = Pulla(iqm_server_url) ``` -------------------------------- ### Download and build documentation for an older version Source: https://github.com/iqm-finland/sdk/blob/main/README.md Steps to download the source distribution of a specific package version and build its documentation locally. ```bash pip download --no-deps --no-binary=:all: iqm-pulse==11.2.0 ``` ```bash tar -xzf iqm_pulse-11.2.0.tar.gz ``` ```bash cd iqm_pulse-11.2.0 ``` ```bash python -m sphinx docs build/docs ``` -------------------------------- ### Running a circuit with IQMSampler Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_cirq.md Example of how to run a circuit using IQMSampler, including routing and decomposition. ```python sampler = IQMSampler(iqm_server_url, quantum_computer=quantum_computer) routed_circuit, _, _ = sampler.device.route_circuit(circuit) decomposed_circuit = sampler.device.decompose_circuit(routed_circuit) result = sampler.run(decomposed_circuit, repetitions=10) print(result.measurements['m']) ``` -------------------------------- ### Get standard compiler settings Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Example - Simple Dynamical Decoupling.ipynb Retrieves the standard compiler settings without any specific dynamical decoupling configurations. ```python standard_compiler = p.get_standard_compiler() standard_settings = standard_compiler.get_settings(circuits=circuits) dd_settings = standard_compiler.get_settings(circuits=circuits) ``` -------------------------------- ### Build documentation for versions < 20.12 Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/readme.md Command to build documentation locally for very old versions of IQM Client. ```bash tox run -e docs ``` -------------------------------- ### Custom Transpilation with Qubit Restriction Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md Example of forcing the transpiler to use a strict subset of qubits on the device. ```python qubits = [4, 3, 8] qubit_index_to_name = {i: backend.index_to_qubit_name(q) for i, q in enumerate(qubits)} # or # qubits = ['QB5', 'QB4', 'QB9'] # qubit_index_to_name = dict(enumerate(qubits)) transpiled_circuit = transpile_to_IQM(circuit, backend=backend, restrict_to_qubits=qubits) print(transpiled_circuit.draw(output='text', idle_wires=False)) ``` -------------------------------- ### Build documentation for versions >= 20.12 and < 33.0.0 Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/readme.md Command to build documentation locally for older versions of IQM Client. ```bash ./docbuild ``` -------------------------------- ### IQMSampler Initialization Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_cirq.md Example of how to import and potentially initialize IQMSampler for running circuits on an IQM quantum computer. ```Python from iqm.cirq_iqm.iqm_sampler import IQMSampler ``` -------------------------------- ### Classical Control Example Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_cirq.md Demonstrates how to use `with_classical_controls()` to apply gates conditionally based on measurement results. ```Python import cirq q1, q2 = cirq.NamedQubit('Alice'), cirq.NamedQubit('Bob') circuit = cirq.Circuit( cirq.X(q1), cirq.measure(q1, key='A'), cirq.X(q2).with_classical_controls('A'), cirq.measure(q1, q2, key='final'), ) print(circuit) ``` ```text Alice: ───X───M───────M('final')─── ║ │ Bob: ─────────╫───X───M──────────── ║ ║ A: ═══════════@═══^════════════════ ``` -------------------------------- ### Compile and Execute Circuit using Pulla Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Quick Start.ipynb Converts the Qiskit circuit to Pulla format, compiles it into an instruction schedule, and submits it for execution. ```python # Transpile the circuit using Qiskit, and then convert it into Pulla format. qc_transpiled = transpile(qc, backend=backend, layout_method='sabre', optimization_level=3) qc_optimized = optimize_single_qubit_gates(qc_transpiled) circuits, compiler = qiskit_to_pulla(p, backend, qc_optimized) # Compile the circuit into an instruction schedule playlist. job_definition, context = compiler.compile(circuits) # Pulla.submit_playlist() returns a SweepJob object. # The measurements are obtained using SweepJob.result() after SweepJob.wait_for_completion(). job = p.submit_playlist(job_definition, context=context) job.wait_for_completion() qiskit_result = sweep_job_to_qiskit(job, shots=shots) print(f"Raw results:\n{job.result()}\n") print(f"Qiskit result counts:\n{qiskit_result.get_counts()}\n") visualization.plot_histogram(qiskit_result.get_counts()) ``` -------------------------------- ### Execute on a naively chosen layout Source: https://github.com/iqm-finland/sdk/blob/main/iqm_qubit_selector/docs/qubit_selector_example.ipynb Transpiles the GHZ circuit using default optimization and runs it on the backend to get counts. ```python qc_t = transpile(qc_algo, backend=backend, optimization_level=3) num_shots = 2000 job = backend.run(qc_t, shots=num_shots).result() counts_naive = job.get_counts() plot_histogram(counts_naive) ``` -------------------------------- ### Running Transpiled Circuit with Qubit Mapping Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md Example of providing a mapping from qubit indices to device qubits for the run method. ```python job = backend.run(transpiled_circuit, qubit_index_to_name=qubit_index_to_name) ``` -------------------------------- ### Run Quantum Volume Benchmark Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/examples/example_quantum_volume.ipynb Initializes and runs the Quantum Volume benchmark. ```python benchmark_qv = QuantumVolumeBenchmark(backend, EXAMPLE_QV) run0_qv = benchmark_qv.run() ``` -------------------------------- ### Custom Transpilation with Existing MoveGates Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_qiskit.md Example of transpiling a native Star architecture circuit with MoveGate instances using transpile_to_IQM. ```python from iqm.iqm_client.transpile import ExistingMoveHandlingOptions from iqm.qiskit_iqm import IQMCircuit, transpile_to_IQM move_circuit = IQMCircuit(3) move_circuit.h(0) move_circuit.move(0, 1) move_circuit.h(2) move_circuit.cz(2, 1) move_circuit.h(2) move_circuit.move(0, 1) # Using transpile() does not work here, as the circuit already contains a MoveGate transpiled_circuit = transpile_to_IQM(move_circuit, backend=resonator_backend, existing_moves_handling=ExistingMoveHandlingOptions.KEEP) print(transpiled_circuit.draw(output='text', idle_wires=False)) ``` -------------------------------- ### Benchmark Configuration Examples Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/README.md Python code demonstrating the configuration for Interleaved RB, Mirror RB, and Quantum Volume benchmarks. ```python from iqm.benchmarks.randomized_benchmarking.interleaved_rb.interleaved_rb \ import InterleavedRBConfiguration from iqm.benchmarks.randomized_benchmarking.mirror_rb.mirror_rb \ import MirrorRBConfiguration from iqm.benchmarks.quantum_volume.quantum_volume \ import QuantumVolumeConfiguration EXAMPLE_IRB = InterleavedRBConfiguration( qubits_array=[[3,4],[8,9]], sequence_lengths=[2**(m+1)-1 for m in range(7)], num_circuit_samples=30, shots=2**10, calset_id=None, parallel_execution=True, interleaved_gate = "iSwapGate", interleaved_gate_params = None, simultaneous_fit = ["amplitude", "offset"], ) EXAMPLE_MRB = MirrorRBConfiguration( qubits_array=[[0,1], [0,1,3,4], [0,1,3,4,8,9], [0,1,3,4,8,9,13,14], [0,1,3,4,8,9,13,14,17,18]], depths_array=[[2**m for m in range(9)], [2**m for m in range(8)], [2**m for m in range(7)], [2**m for m in range(6)], [2**m for m in range(5)]], num_circuit_samples=10, num_pauli_samples=5, shots=2**8, two_qubit_gate_ensemble={"CZGate": 0.7, "iSwapGate": 0.3}, density_2q_gates=0.25, calset_id=None, ) EXAMPLE_QV = QuantumVolumeConfiguration( num_circuits=800, 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, max_circuits_per_batch=500, max_gates_per_batch=60_000, # Will be used if it renders a smaller # max batch size than max_circuits_per_batch rem=True, mit_shots=1_000, ) ``` -------------------------------- ### Build documentation for versions >= 33.0.0 Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/readme.md Command to build documentation locally for newer versions of IQM Client. ```bash sphinx-build -q -d build/.doctrees/iqm-client iqm-client/docs build/docs/iqm-client ``` -------------------------------- ### IQMDevice instance qubits Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_cirq.md Get the list of qubits in a particular device by accessing the qubits attribute of a corresponding IQMDevice instance. ```python print(adonis.qubits) ``` -------------------------------- ### Authentication using Environment Variable Source: https://github.com/iqm-finland/sdk/blob/main/iqm_pulla/docs/Quick Start.ipynb Sets the IQM_TOKEN environment variable and initializes the Pulla client. ```python import os os.environ["IQM_TOKEN"]="" p = Pulla(iqm_server_url) ``` -------------------------------- ### Setting IQM_CLIENT_REQUESTS_TIMEOUT environment variable Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/integration_guide.md Example of how to set the `IQM_CLIENT_REQUESTS_TIMEOUT` environment variable to override the default network request timeout for `IQMClient` methods. ```bash $ export IQM_CLIENT_REQUESTS_TIMEOUT=300 ``` -------------------------------- ### Wait for Completion and Get Results Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/integration_guide.md Waits for a submitted circuit job to complete and retrieves the results. This method blocks until the job reaches a terminal status. ```python job_status = job.wait_for_completion() print(job_status) job_result = job.result() ``` -------------------------------- ### Using ScheduleBuilder to get and call gate implementations Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/custom_gates.md Examples of how to retrieve gate implementations using ScheduleBuilder and then call them with QuantumOp parameters to create a TimeBox. ```python # this initializes the _default implementation_ class of PRX for QB1 default_prx_QB1 = builder.get_implementation("prx", ("QB1",)) # this initializes a specific PRX implementation for QB1, not necessarily the default special_prx_QB1 = builder.get_implementation("prx", ("QB1",), impl_name="my_special_PRX") # calling the implementation with the QuantumOp param values creates a TimeBox that can be then scheduled with # the normal scheduling logic default_box = default_prx_QB1(angle=np.pi, phase=np.pi/2) ``` -------------------------------- ### Routing with a custom initial mapper Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/user_guide_cirq.md Shows how to provide a custom initial mapper to route_circuit() for a specific starting mapping of logical to physical qubits. ```python initial_mapper = cirq.HardCodedInitialMapper({q1: adonis.qubits[2], q2: adonis.qubits[0]}) routed_circuit_2, _, _ = adonis.route_circuit( decomposed_circuit, initial_mapper=initial_mapper, ) print(routed_circuit_2) ``` -------------------------------- ### Example Instructions Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/concepts.md Illustrates common hardware instructions used in IQM Pulse for controlling quantum hardware. ```python IQPulse VirtualRZ ReadoutTrigger Wait ``` -------------------------------- ### Setting IQM_CLIENT_REQUESTS_TIMEOUT environment variable on Windows Source: https://github.com/iqm-finland/sdk/blob/main/iqm_benchmarks/docs/integration_guide.md Example of how to set the `IQM_CLIENT_REQUESTS_TIMEOUT` environment variable on Windows to override the default network request timeout for `IQMClient` methods. ```batch set IQM_CLIENT_REQUESTS_TIMEOUT=300 ``` -------------------------------- ### Build the front page for production use Source: https://github.com/iqm-finland/sdk/blob/main/docs/README.md Commands to install npm dependencies, build the front page, and copy production assets to the public directory. ```bash npm ci npm run build cp -r dist/* public/ cp src/favicon.ico public/favicon.ico ```