How to run multiple configurations of target parameters with the Resource Estimator

In this article, you learn how to run multiple configurations of target parameters and compare them using the Azure Quantum Resource Estimator.

For information about how to run the Resource Estimator, see Different ways to use the Resource Estimator.

Prerequisites

The following prerequisites are required to run the Resource Estimator:

To run Q# programs in the Resource Estimator, you need the following:

If you want to use Python in VS Code, you also need the following:

  • Install the latest version of the Python, and Jupyter extensions for VS Code.

  • The latest Azure Quantum qsharp package.

    python -m pip install --upgrade qsharp 
    

To submit jobs to the Resource Estimator, you need the following:


Batching with the Resource Estimator

The Azure Quantum Resource Estimator allows you to submit jobs with multiple configurations of job parameters, also referred as items, as a single job to avoid rerunning multiple jobs on the same quantum program.

A resource estimation job consist of two types of job parameters:

  • Target parameters: qubit model, QEC schemes, error budget, constraints on the component-level, and distillation units.
  • Operation arguments: arguments that can be passed to the program (if the QIR entry point contains arguments).

One item consists of one configuration of job parameters, that is one configuration of target parameters and operation arguments. Several items are represented as an array of job parameters.

Some scenarios where you may want to submit multiple items as a single job:

  • Submit multiple target parameters with same operation arguments in all items.
  • Submit multiple target parameters with different operation arguments in all items.
  • Easily compare multiple results in a tabular format.
  • Easily compare multiple results in a chart.

If you are estimating the resources of a Q# program, you can run multiple configurations of target parameters, also known as batching. Batching with Q# can be done in a Jupyter Notebook in VS Code.

You can perform a batch estimation by passing a list of target parameters to the params parameter of the qsharp.estimate function. The following example shows how to submit two configurations of target parameters as a single job. The first configuration uses the default target parameters, and the second configuration uses the qubit_maj_ns_e6 qubit parameter and the floquet_code QEC scheme.

In the same Jupyter Notebook of your Q# program, add a new cell and run the following code:

result_batch = qsharp.estimate("RunProgram()", params=
                [{}, # Default parameters
                {
                    "qubitParams": {
                        "name": "qubit_maj_ns_e6"
                    },
                    "qecScheme": {
                        "name": "floquet_code"
                    }
                }])
result_batch.summary_data_frame(labels=["Gate-based ns, 10⁻³", "Majorana ns, 10⁻⁶"])

You can also construct a list of estimation target parameters using the EstimatorParams class. The following code shows how to submit six configurations of target parameters as a single job.

from qsharp.estimator import EstimatorParams, QubitParams, QECScheme

labels = ["Gate-based µs, 10⁻³", "Gate-based µs, 10⁻⁴", "Gate-based ns, 10⁻³", "Gate-based ns, 10⁻⁴", "Majorana ns, 10⁻⁴", "Majorana ns, 10⁻⁶"]

params = EstimatorParams(num_items=6)
params.error_budget = 0.333
params.items[0].qubit_params.name = QubitParams.GATE_US_E3
params.items[1].qubit_params.name = QubitParams.GATE_US_E4
params.items[2].qubit_params.name = QubitParams.GATE_NS_E3
params.items[3].qubit_params.name = QubitParams.GATE_NS_E4
params.items[4].qubit_params.name = QubitParams.MAJ_NS_E4
params.items[4].qec_scheme.name = QECScheme.FLOQUET_CODE
params.items[5].qubit_params.name = QubitParams.MAJ_NS_E6
params.items[5].qec_scheme.name = QECScheme.FLOQUET_CODE

qsharp.estimate("RunProgram()", params=params).summary_data_frame(labels=labels)

Note

If you run into any issue while working with the Resource Estimator, check out the Troubleshooting page, or contact AzureQuantumInfo@microsoft.com.