How to run quantum circuits on Aer GPU emulation
Aer is the high-performance emulator framework for the Qiskit software stack. It provides powerful backends to emulate quantum circuits with realistic noise models, using advanced optimization techniques.
While Aer can run on a local laptop, simulating complex circuits with many qubits requires significant computational power. Scaleway QaaS allows you to offload these heavy simulations to dedicated GPU and CPU clusters directly from your Python code.
Why use Aer on Scaleway?
Scaleway provides a seamless bridge between your local Qiskit environment and cloud-based High-Performance Computing (HPC) resources:
- Multi purpose emulation: Aer is a robust emulator that supported many simulation methods:
statevector,density_matrix,matrix_product_state,unitaryandtensor_network. All this methods are supported by our Platforms. - Billed at time: The billing starting time begins only when the Platform is fully operational and the first Job can be executed.
- GPU acceleration: Instantly allocate powerful Nvidia GPUs (like H100 or L40S cluster ) to accelerate tensor-network or statevector emulator.
- Optimized stack: We provide pre-configured environments (Platforms) tuned for high performance, ensuring Aer utilizes the underlying hardware to its full potential.
- Noise model support: Our Aer-based Platforms support custom noise model with you are willing to mimic a real QPU behaviour. See further doc.
- Data compression: To minimize latency and bandwidth usage, quantum circuits (upload) and emulator results (download) are automatically compressed during transfer.
- Transparent pricing: You connect to resources on-demand. The pricing model is similar to standard Cloud Instances: you pay for the compute resources allocated during your simulation time.
How to acess Aer with Scaleway
To run your remote emulator, you simply need to switch your Qiskit backend to a Scaleway-hosted emulator.
The following example demonstrates how to run a computation on a Scaleway GPU instance. The workflow is identical to using a local emulator, but the computation happens remotely.
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 the Provider # Ensure you have your credentials ready provider = ScalewayProvider( project_id="$SCW_PROJECT_ID", secret_key="$SCW_SECRET_KEY" ) # 2. Select the Aer GPU Platform # Example platform ID: 'EMU-AER-H100' (Aer emulator using an Nvidia H100 GPU) backend = provider.get_backend("EMU-AER-H100") # 3. Create a Quantum Circuit # Let's create a Bell state with measurement qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) qc.measure_all() # 4. No transpilation # Scaleway QaaS handles the transpilation server-side for you # 5. Execute on remote emulator # The job is sent to Scaleway, executed on the GPU, and results are returned compressed. job = backend.run(qc, shots=10000) # 6. Get Results result = job.result() print("Results:", result) -
Save the script. In this example we save it as
computation.py. -
Run the script.
python ~/computation.py