How to compare multiple configurations of target parameters with the Resource Estimator
In this article, you learn how to run multiple configurations of target parameters at the same time and compare them using the Azure Quantum Resource Estimator.
The Azure Quantum Resource Estimator allows you to run multiple configurations of target parameters as a single job to avoid rerunning multiple jobs on the same quantum program.
One job may consists of multiple items or configurations of target parameters. Some scenarios where you may want to run multiple items as a single job:
- Run multiple target parameters with same operation arguments in all items.
- Run 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.
For information about how to run the Resource Estimator, see Different ways to use the Resource Estimator.
Prerequisites
The latest version of Visual Studio Code or open VS Code on the Web.
The latest version of the Quantum Development Kit extension. For installation details, see Installing the QDK on VS Code.
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
Running multiple configurations with the Resource Estimator
Running multiple configurations of target parameters as a single job in Q# can be done in a Jupyter Notebook in VS Code. You can pass a list of target parameters to the params
parameter of the qsharp.estimate
function.
The following example shows how to run 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 batch 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.