Get started

Run your first calculation with Boulder Opal

You're ready to run calculations with Boulder Opal.

In this get started guide, you will run through the steps to get Boulder Opal ready for your calculations in order to automate and optimize quantum hardware performance at scale.

If you want to learn more, you can read our Boulder Opal overview topic.

Requirements

1. Import required libraries

import boulderopal as bo

If you experience an error while attempting to import the above libraries, please run the following command using the terminal. Please note that after installing new packages, you may need to restart your notebook session or kernel for the newly installed packages to be recognized.

pip install boulder-opal qctrl-visualizer qctrl-open-controls

Optional: Configure your organization

If you are a member of multiple organizations, you must specify which organization's compute environment to use by using bouleropal.cloud.set_organization.

bo.cloud.set_organization("organization_slug")

where organization_slug is the unique ID used to identify this organization. You can check organization names and other details by visiting Q-CTRL Accounts.

2. Configure machine(s)

Before you start processing your calculations, you can request some worker machines to be online with by using boulderopal.cloud.request_machines method,

bo.cloud.request_machines(machine_count)

where machine_count is the number of machines requested to be online (with the maximum set to the number of machines allocated in your plan). This will warmup the machines to minimize queue times for your actual calculations, refer to the Computational resources in Boulder Opal topic for more details. If you skip requesting machines, the system will autoscale based on the number of calculations required.

3. Submit a calculation

You are now ready to perform your first calculation using Boulder Opal.

# Run a simple π-pulse simulation and print the resulting infidelity.
import numpy as np

graph = bo.Graph()
amplitude = np.pi * 1e5  # rad/s
duration = 5e-6  # s
pi_pulse = graph.constant_pwc(amplitude, duration)
infidelity = graph.infidelity_pwc(
    hamiltonian=pi_pulse * graph.pauli_matrix("X"),
    target=graph.target(graph.pauli_matrix("X")),
    name="infidelity",
)
result = bo.execute_graph(graph, "infidelity")
print(f"π-pulse infidelity: {result['output']['infidelity']['value']:.3e}")
π-pulse infidelity: 4.441e-16

The first time you run a calculation with Boulder Opal, you'll be asked to authenticate. An authentication link will open up automatically, or be provided for you to copy and open in your browser of choice. You will be asked to enter your credentials if you are not already authenticated on our web app.

It should look something like this:

Authentication URL:

https://id.q-ctrl.com/auth/...

The URL above should be automatically opened in your default web browser.
(Please copy and paste in case it doesn't open automatically)

Authenticate your credentials in your browser...

Finalizing authentication...
Successful authentication!

You are now ready to run your calculations!

You can monitor your calculations and manage your computing resources in the Boulder Opal web app. Check out our tutorials, guiding you through Boulder Opal's core capabilities step by step, and topics, discussing the key concepts surrounding Boulder Opal.

Was this useful?

cta background

New to Boulder Opal?

Get access to everything you need to automate and optimize quantum hardware performance at scale.