Skip to content

Latest commit

 

History

History
109 lines (78 loc) · 6.2 KB

resource-estimator-known-estimates.md

File metadata and controls

109 lines (78 loc) · 6.2 KB
author description ms.date ms.author ms.service ms.subservice ms.topic no-loc title uid
SoniaLopezBravo
Learn how to use pre-calculated estimates for your Q# programs with the Azure Quantum Resource Estimator.
06/03/2024
sonialopez
azure-quantum
qdk
how-to
Q#
$$v
target
targets
Use Known Estimates with the Resource Estimator
microsoft.quantum.resource-estimator-known-estimates

How to use known estimates with the Resource Estimator

In this article, you learn how to use pre-calculated estimates and optimize the execution of the Azure Quantum Resource Estimator.

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

Prerequisites

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 

Use known estimates for an operation

If you already know some estimates for an operation, for example from a published paper, one way to reduce the execution time is taking the known estimates and incorporate them into the overall program cost.

Some scenarios where you may want to perform estimation from pre-calculated estimates:

  • You want to try a novel algorithm described in a paper to check if it improves the performance of your program. You can take estimates from the paper and incorporated them into the program.
  • You want to develop program top-down, that is, start developing from main function and then implement lower levels. You can use the known estimates at the top level with expected estimates for the entire program. As development process progresses, new components start calling to the known estimates and expected estimates are replaced by the actual implementation. In this way, estimates for the entire program are known upfront and get more precise as development progresses.

You can use the AccountForEstimates Q# operation to pass known estimates to the Resource Estimator.

Note

The special operation AccountForEstimates is an intrinsic operation for the Resource Estimator. It's not supported by other execution targets.

For example, consider the following Q# operation called FactoringFromLogicalCounts that takes a list of known estimates and a list of qubits.

open Microsoft.Quantum.ResourceEstimation;

operation FactoringFromLogicalCounts() : Unit {
    use qubits = Qubit[12581];

    AccountForEstimates(
        [TCount(12), RotationCount(12), RotationDepth(12),
         CczCount(3731607428), MeasurementCount(1078154040)],
        PSSPCLayout(), qubits);
}

The AccountForEstimates operation can take the following parameters:

Functions with AccountForEstimates Description
AuxQubitCount(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the number of auxiliary qubits is equal to the amount.
TCount(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the number of T gates is equal to the amount.
MeasurementCount(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the number of measurements is equal to the amount.
RotationCount(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the number of rotations is equal to the amount.
RotationDepth(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the rotation depth is equal to the amount.
CczCount(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the number of CCZ gates is equal to the amount.
PSSPCLayout() Indicate Parallel Synthesis Sequential Pauli Computation (PSSPC) layout. For more information, see arXiv:2211.0769.

You can use the LogicalCounts operation to pass known estimates to the Resource Estimator.

Note

The special operation LogicalCounts is an intrinsic operation for the Resource Estimator. It's not supported by other execution targets.

For example, consider the following code that takes a list of known estimates.

logical_counts = LogicalCounts({
    'numQubits': 12581,
    'tCount': 12,
    'rotationCount': 12,
    'rotationDepth': 12,
    'cczCount': 3731607428,
    'measurementCount': 1078154040})

logical_counts.estimate(params)

Note

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

Related content

  • Understand the results of the Resource Estimator
  • Different ways to run the Resource Estimator
  • Customize resource estimates to machine characteristics
  • Tutorial: Estimate the resources of a quantum chemistry problem