Skip to content

Submitting jobs to Azure Quantum

Bill Ticehurst edited this page Feb 23, 2024 · 11 revisions

Submitting jobs to Azure Quantum

The VS Code extension supports integration with the Azure Quantum service to submit jobs to hardware and simulators from various providers. You can see the list of current providers in the Azure Quantum documentation at https://learn.microsoft.com/en-us/azure/quantum/qc-target-list. This extension can only submit jobs to provider 'targets' that support QIR. See the QIR wiki page for more information.

Integration with Azure Quantum is done via a section added to the Explorer view of the VS Code sidebar. Ensure this is open via Cmd/Ctrl+Shift+E or the View menu, then expand the QUANTUM WORKSPACES section. Before sign-in, it will appear as shown below:

image

To submit to real quantum environments, or to use a specific vendor's simulator, you can submit your Q# file to Azure Quantum. Note that only base-profile-compliant quantum programs can be submitted to Azure Quantum. In the VS Code status bar, if you see an indicator stating "Unrestricted", click on it and switch the QIR profile to Base before proceeding.

image

Follow the following steps to submit your base-profile-compliant Q# file to Azure Quantum:

  1. Sign in to an Azure Quantum Workspace.
    1. From the VS Code Command Palette, run the "Q#: Add an Azure Quantum Workspace" command and follow the instructions provided. (Note: This may prompt several times for permission as it requests access to the Azure subscription and Quantum workspace).
  2. Select a provider.
    1. Ensure you have a Q# file selected and open.

    2. Find the "Quantum Workspaces" section image

    3. Select the provider you want to submit to.

    4. Either click the ⏵︎ (Play) button to the right of the provider, or run the "Q#: Submit current Q# program" command from the Command Palette while a provider is selected. (Note: These will only be available if the provider selected supports jobs targeting the QIR Base profile, which not all do currently).

    5. Enter a friendly name and the number of shots for the job submission in the input boxes that appear.

    6. After a short while, if submitted successfully, the new job should appear in the Jobs list for the workspace. Currently you need to manually refresh using the Refresh icon in the tree view to update this list.

    7. If the job completed successfully, you will see an icon to the right of the job in the tree view to download the results. (Currently a histogram in text format).