Accelerated Quantum Supercomputing with the NVIDIA CUDA-Q and Amazon Braket Integration : US Pioneer Global VC DIFCHQ SFO Singapore – Riyadh Swiss Our Mind

As quantum computers scale, tasks such as controlling quantum hardware and performing quantum error correction become increasingly complex. Overcoming these challenges requires tight integration between quantum processing units (QPUs) and AI supercomputers, a paradigm known as accelerated quantum supercomputing.

Increasingly, AI methods are being used by researchers up and down the quantum stack from the design of quantum hardware to compact circuit synthesis, and even as decoders for quantum error correction, a crucial ingredient for achieving fault-tolerant quantum computing.

To achieve breakthroughs, researchers need access to both QPUs and GPUs to develop and test hybrid applications, especially those that leverage AI.

However, a persistent problem that is slowing down quantum research and development is the diversity of access procedures, software stacks, and pricing models that researchers must manage to access quantum hardware. What’s needed is a powerful development environment able to seamlessly access QPU hardware from various vendors, with minimal spin-up logistics, while maintaining a consistent user experience.

In an effort to make accelerated quantum computing more accessible, NVIDIA is working with AWS to expand how users of the NVIDIA CUDA-Q platform can access quantum hardware. By integrating the NVIDIA CUDA-Q and Amazon Braket platforms (Figure 1), CUDA-Q users have greater access to diverse QPU hardware through Amazon Braket on a pay-as-you-go basis, without upfront costs or long-term commitments.

This integration also means that Amazon Braket users now also have a ready-to-go CUDA-Q programming environment for developing and testing accelerated hybrid applications.

A schematic shows CUDA-Q as the entry point for submitting Braket hybrid jobs which can run on GPUs and QPUs.
Figure 1. CUDA-Q runs on Amazon Braket hybrid jobs

CUDA-Q users can use Amazon Braket backends

The braket backend is now available for CUDA-Q users. Develop code locally with CUDA-Q and, using only Amazon Braket credentials, run it on trapped-ion QPUs from IonQ, superconducting QPUs from Rigetti and IQM, and the analog QPU from QuEra, through the cloud. This way, you have streamlined access to QPU hardware and the flexibility necessary for research without having to enter into lengthy procurements with individual hardware vendors.

To get started, enable Amazon Braket  with AWS Account and Identity Access Management (IAM). AWS IAM enables you to access AWS services through the AWS Management Console, command line interface (CLI), or software development kit (SDK). Upon creation of your AWS IAM user, you can generate an access key using the IAM Access Management Console and import those credentials into the following code example:

export AWS_DEFAULT_REGION=”us-east-1
export AWS_ACCESS_KEY_ID="<key_id>"
export AWS_SECRET_ACCESS_KEY="<access_key>"
export AWS_SESSION_TOKEN="<token>"

When using QPUs through Amazon Braket, customer data is processed in third-party hosted facilities. You must agree to the Amazon Braket terms and conditions to authorize the service to send customer circuits to third-party hardware vendors.

After agreeing to these terms, you can specify an AWS device, in this case, IQM’s Garnet superconducting QPU, by changing the CUDA-Q target to braket and setting the machine parameter as the device.

import cudaq
#Select QPU and Braket backend
device = "arn:aws:braket:eu-north-1::device/qpu/iqm/Garnet"
cudaq.set_target("braket", machine=device)
#Build Bell state CUDA-Q kernel
@cudaq.kernel
def kernel():
   
qubits = cudaq.qvector(2)
      h(qubits[0])
      x.ctrl(qubits[0], qubits[1])
      mz(qubits)
result = cudaq.sample(kernel, shots_count=1000)

This code can run on any other QPU by pointing the device variable to the appropriate Amazon Resource Name (ARN).

There are no upfront fees or commitments to use QPUs on Amazon Braket. This means that you can get started with using QPUs without entering into contracts with individual hardware vendors. For more information about the QPUs that you can use on Amazon Braket, see Amazon Braket Pricing.

Amazon Braket users can run CUDA-Q hybrid jobs

You can also access CUDA-Q directly through Amazon Braket. To get started, load a prebuilt container to your Amazon ECR repository using the following shell script provided in the Jupyter notebook:

! container/container_build_and_push.sh braket-cudaq-byoc-job us-west-2

The following example demonstrates how easy it is to prepare CUDA-Q code within the Amazon Braket experience. The /0_hello_cudaq_jobs.ipynb Jupyter notebook has the full code, including the initialization of the CUDA-Q Braket container that is assumed before running the following code.

import cudaq
image_uri = "<ecr-image-uri>"
instance_config=InstanceConfig(instanceType='ml.p3.2xlarge')
@hybrid_job(device='local:nvidia/nvidia', image_uri=image_uri, instance_config=instance_config)
def hello_quantum():
 
    # define the backend
    device=get_job_device_arn()
    cudaq.set_target(device.split('/')[-1])
    # define the Bell circuit
    kernel = cudaq.make_kernel()
    qubits = kernel.qalloc(2)
    kernel.h(qubits[0])
    kernel.cx(qubits[0], qubits[1])
    # sample the Bell circuit
    result = cudaq.sample(kernel, shots_count=1000)
    measurement_probabilities = dict(result.items())
   
    return measurement_probabilities

You can create a hybrid job that takes a CUDA-Q simulator backend as the device, the CUDA-Q Braket container image, and an instance that specifies the GPUs to be accessed for the computation, which is an NVIDIA V100 Tensor Core GPU in this case. Then, construct a CUDA-Q kernel along with a protocol such as sample to obtain the desired output.

For more information about available instances and their corresponding GPUs, see Amazon Braket Quotas and notebook tutorials in the /amazon-braket GitHub repo that demonstrate how to parallelize CUDA-Q code across multiple GPU-simulated QPUs.

The procedure is similar for accessing one of Braket’s available QPU backends. The first step is to define a target QPU from Braket. The following code specifies IQM’s Garnet superconducting QPU:

device_arn = "arn:aws:braket:eu-north-1::device/qpu/iqm/Garnet"

The QPU is then specified as the device for the hybrid job.

@hybrid_job(device=device_arn, image_uri=image_uri)

The only other change is that the CUDA-Q target must be changed to braket along with the machine parameter, which is set as the device.

    # define the backend
    device=get_job_device_arn()
    cudaq.set_target("braket", machine=device)

Hybrid jobs receive priority access to QPUs, ensuring faster experiment times and minimal hardware drift to improve results.

Get started today

NVIDIA and AWS are collaborating to offer researchers and developers a clear, straightforward path to access the tools essential for advancing accelerated quantum supercomputing.

The integration of CUDA-Q and Amazon Braket makes it easier than ever to access powerful GPU computing resources and a wide array of QPUs, without the need for contracts with specific vendors. Researchers can now experience the best of both worlds by taking advantage of the performance of CUDA-Q and the flexibility provided by Amazon Braket.

If you are interested in trying the new CUDA-Q Braket backend, download CUDA-Q and see Advancing Hybrid Quantum Computing Research with Amazon Braket and NVIDIA CUDA-Q.

AWS customers who want to take advantage of CUDA-Q within the Amazon Braket experience can learn how to get started in the AWS Braket documentation. For more information about how to run more sophisticated hybrid jobs accelerated and parallelized with CUDA-Q, explore examples in the /amazon-braket GitHub repo.