Run quantum circuits on CUDA-Q
** CUDA Quantum (CUDA-Q)** is a framework developed by NVIDIA designed for quantum computing applications. It is part of NVIDIA's efforts to integrate quantum computing with classical computing systems, specifically targeting quantum circuit simulation, quantum algorithms, and hybrid quantum-classical workflows. CUDA-Q leverages the power of CUDA (NVIDIA's parallel computing platform) to accelerate quantum computing simulations and provides a foundation for quantum software development that can run on NVIDIA GPUs.
Scaleway QaaS allows you to scale CUDA-Q beyond your local machine. You can execute your emulated computation on dedicated GPU cluster (like Nvidia H100, L40S and B300) seamlessly, benefiting from pre-configured MPI setup and optimized environments.
Why use CUDA-Q on Scaleway?
- Billed at time: The billing starting time begins only when the Session is fully operational and the first Job can be executed.
- Multi-Framework support: Uniquely, our CUDA-Q platforms are accessible via both CUDA-Q and Qiskit. You can choose your preferred language while benefiting from the CUDA-Q runtime.
- On-the-shelf MPI environment: CUDA-Q benefits from multi GPUs infrastructure via OpenMPI but it can be a boilerplate to configure, Scaleway's QaaS handles it for you.
- Smart compression: Just like our Aer and Qsim offerings, the platform automatically compresses circuit data and computation results to optimize network throughput and latency.
How to access via CUDA-Q (Native)
CUDA-Q SDK is the native language to run CUDA-Q runtime. Using the cuda-q package allows you to run your circuits directly on our cloud GPUs.
CUDA-Q emulation is accessible through multiple SDKs. Please check SDK/Backend compatibility.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account with a valid Project ID
- A Scaleway API Key (Secret Key)
-
Install the
cuda-qpackage. Refer to the NVIDIA documentation for more information.pip install cuda-q -
Create a file with the following computation script. Replace
$SCW_PROJECT_IDand$SCW_SECRET_KEYwith your Scaleway Project ID and secret key.import cudaq # 1. Initialize Scaleway target cudaq.set_target('scaleway', machine="EMU-CUDAQ-8B300SXM", project_id="<$SCW_PROJECT_ID>", secret_key="<$SCW_SECRET_KEY>" ) # 2. Create a CUDA-Q kernel @cudaq.kernel def bell(): qubits = cudaq.qvector(2) h(qubits[0]) x.ctrl(qubits[0], qubits[1]) mz(qubits) # 3. Run the kernel on Scaleway cloud counts = cudaq.sample(bell, shots_count=1000) -
Save the script. In this example we save it as
cudaq.py. -
Run the script.
python ~/cudaq.py
How to access via Qiskit
Before you start
To complete the actions presented below, you must have:
- A Scaleway account with a valid Project ID.
- A Scaleway API Key (Secret Key).
- Python and
qiskitinstalled on your local machine
-
Install the
qiskit-scalewayprovider. Refer to the Qiskit Scaleway GitHub repository for more information.pip install qiskit-scaleway -
Create a file with the following computation script. Replace
$SCW_PROJECT_IDand$SCW_SECRET_KEYwith your Scaleway Project ID and secret key.from qiskit import QuantumCircuit from qiskit_scaleway import ScalewayProvider # 1. Initialize Provider provider = ScalewayProvider( project_id="$SCW_PROJECT_ID", secret_key="$SCW_SECRET_KEY" ) # 2. Select a CUDA-Q Backend # Scaleway bridges the Qiskit circuit to the CUDA-Q engine automatically backend = provider.get_backend("EMU-CUDAQ-H100") # 3. Create & Run Circuit qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) qc.measure_all() job = backend.run(qc, shots=1000) print("Counts:", job.result().get_counts()) -
Save the script. In this example we save it as
cudaq.py. -
Run the script.
python ~/cudaq.py