GPU Backend (NVIDIA cuStateVec & Custom Kernels)
Maestro supports hardware-accelerated simulation on NVIDIA GPUs through cuStateVec and custom CUDA kernels.
Availability & Initialization
import maestro
if maestro.is_gpu_available():
print("GPU acceleration available")
maestro.init_gpu()
GPU Simulation
gpu_sv_config = maestro.SimulatorConfig(
simulator_type=maestro.SimulatorType.Gpu,
simulation_type=maestro.SimulationType.Statevector,
)
result = maestro.simple_execute(qasm, config=gpu_sv_config, shots=1000)
gpu_mps_config = maestro.SimulatorConfig(
simulator_type=maestro.SimulatorType.Gpu,
simulation_type=maestro.SimulationType.MatrixProductState,
max_bond_dimension=64,
)
result_mps = maestro.simple_execute(qasm, config=gpu_mps_config, shots=1000)
QuEST Backend (MPI Distributed Simulation)
Maestro integrates the QuEST engine for distributed statevector simulation across cluster nodes.
Running with QuEST
import maestro
if maestro.is_quest_available():
maestro.init_quest()
quest_config = maestro.SimulatorConfig(
simulator_type=maestro.SimulatorType.QuestSim,
simulation_type=maestro.SimulationType.Statevector,
)
result = maestro.simple_execute(qasm, config=quest_config, shots=1024)
- Note
- QuEST only supports SimulationType.Statevector. Attempting to use other simulation methods will raise an exception.
Graceful Hardware Fallback Pattern
For portable workflows across GPU workstations, clusters, and developer laptops:
import maestro
if maestro.is_gpu_available() and maestro.init_gpu():
backend = maestro.SimulatorType.Gpu
elif maestro.is_quest_available() and maestro.init_quest():
backend = maestro.SimulatorType.QuestSim
else:
backend = maestro.SimulatorType.QCSim
config = maestro.SimulatorConfig(simulator_type=backend)
result = maestro.simple_execute(qasm, config=config, shots=1024)