Cross-Backend QIEO: Universal Runtime Portability across OpenMP5, CUDA, HIP, and Multi-Language Interfaces
Organizations: BQP Bengaluru, India
Abstract
Quantum-inspired algorithms emulate quantum mechanical principles, such as, superposition, interference, and probabilistic amplitude evolution, on classical hardware by representing candidate solutions as qubit vectors and evolving them through rotation-gate operators. This approach offers higher optimization performance without physical qubits, and has been shown to achieve order-of-magnitude speedups (10--80) over traditional solvers on combinatorial, high-dimensional NP-hard problems. A critical barrier to adoption, however, is the lack of a unified execution framework that delivers both algorithmic performance and hardware portability. We present Cross-Backend Quantum Inspired Evolutionary Optimizer (QIEO), the runtime core of BQP's BQPhy solver, which addresses this gap through a single-source-of-truth architecture. One C++ implementation of the QIEO algorithm is compiled once per hardware target and exposed to multiple high-level languages via thin binding layers. The framework dispatches to CPU (sequential), OpenMP~5 (multi-core), CUDA (NVIDIA), and HIP (AMD) backends at runtime, adapting kernels to each device's memory hierarchy and warp/wavefront execution model. The framework's real-world utility is validated through binding demonstrations that share the identical C++ runtime. BQPhy's Python library is demonstrated on a neural network hyperparameter optimisation achieving 88.60% test accuracy on MNIST. BQPhy's MATLAB's Toolkit is tested on wind farm layout optimisation attaining ~MWh/yr, which is statistically indistinguishable from particle swarm optimisation and above genetic algorithms on a 32-variable constrained engineering problem. The Julia package tackles the Lotka--Volterra parameter estimation where BQPhy replaces native Julia solvers on the same residual, cutting mean SSE by .
Figures & tables
| Mode | Target | Parallelism Model | Best For | Compile Flag |
|---|---|---|---|---|
| CPU | Single-core CPU | Sequential (scalar) | Debugging, correctness validation, small problems | Default (no flag) |
| OpenMP | Multi-core CPU | Loop parallelism via #pragma omp parallel for ; SIMD vectorisation | Mid-scale problems ( – ) on multi-socket servers | -DUSE_OPENMP=ON |
| GPU/CUDA | NVIDIA GPU (cc 7.0) | Warp-level parallelism + Thrust reduction algorithms | Large-scale problems ( ) where PCIe transfer is amortised | -DUSE_CUDA=ON |
| GPU/HIP | AMD GPU (GFX9+) | Wavefront-level parallelism; mirrors CUDA kernel structure | Same as CUDA target on AMD hardware | -DUSE_HIP=ON |
| Language | Library | Mechanism | Role |
|---|---|---|---|
| C++ | Header-only | Direct inclusion | Zero-overhead integration; exposes full API including template parameters for custom fitness functors. |
| Python | pybind11 [ 9 ] | C++ template-based Python–C interoperability | Converts Python dict and callable objects into C++ data structures; exposes core runtime as Python classes. |
| MATLAB | MEX API [ 10 ] | Native MATLAB C++ interface | Receives struct and function_handle arguments, invokes C++ runtime, returns results as native MATLAB arrays. |
| Julia | CxxWrap [ 11 ] | Automatic C++ wrappers around libBQPhy_Optimiser.so | Converts Julia Dict and Function objects into C++ data structures; exposes the runtime as a native Julia module. |
| Step | C++ Core | Python | MATLAB | Julia |
|---|---|---|---|---|
| Initialize | opt.initialize(params) | opt.initialize(dict) | BQPhy_MEX("init", struct) | Optimizer(Dict) |
| Set model | opt.setModel(fn) | opt.set_model(callable) | Pass @function_handle | set_fitness_function!(opt, fn) |
| Run | opt.runOptimization(acc) | opt.run_optimization(acc) | BQPhy_MEX("run", ...) | optimize!(opt; device) |
| Get result | opt.getBestDesign() | opt.get_result() | BQPhy_MEX("result") | get_best_design(opt) |
| Problem | OpenMP | CUDA (A100) | HIP (MI300X) |
|---|---|---|---|
| Knapsack-512 | 14.3 | 58.7 | 51.2 |
| Rastrigin-200 | 11.8 | 72.1 | 63.4 |
| Rosenbrock-200 | 12.6 | 68.3 | 60.8 |
| Antenna Synth. | 16.1 | 65.9 | 57.3 |
| Geometric mean | 13.6 | 66.1 | 57.9 |
| Variable | Type | Range / Choices |
|---|---|---|
| Learning rate | Continuous | (log-uniform) |
| Hidden units | Integer | |
| Hidden layers | Integer | |
| Activation | Categorical | {ReLU, Tanh, Sigmoid, LeakyReLU} |
| Dropout rate | Continuous |
| Method | Evals | Accuracy | Time (s) | s/Eval |
|---|---|---|---|---|
| BQPhy (QIEO) | 240 | 0.8740 | 46.42 | 0.19 |
| Ray Tune | 12 | 0.8760 | 206.92 | 17.24 |
| Optuna | 12 | 0.8640 | 3.41 | 0.28 |
| Grid Search | 12 | 0.8700 | 2.71 | 0.23 |
| Method | Lr | Hidden | Layers | Activation | Dropout | Accuracy | Time (s) |
| BQPhy (QIEO) | 238 | 1 | LeakyReLU | 0.011 | 0.8860 | 45.05 | |
| Ray Tune [ 28 ] | 223 | 3 | LeakyReLU | 0.101 | 0.8720 | 5389.79 | |
| Optuna [ 29 ] | 227 | 1 | LeakyReLU | 0.398 | 0.8920 | 63.30 | |
| Grid Search [ 30 ] | 200 | 1 | ReLU | 0.300 | 0.8760 | 56.60 | |
| Note: Grid Search exhausted its discrete grid at 216 evaluations (could not reach 240). | |||||||
| Method | Time (s) | s/Eval | Accuracy | Speedup vs. RT |
| BQPhy (QIEO) | 45.05 | 0.19 | 0.8860 | |
| Ray Tune | 5389.79 | 22.46 | 0.8720 | (ref.) |
| Optuna | 63.30 | 0.26 | 0.8920 | |
| Grid Search | 56.60 † | 0.26 † | 0.8760 | |
| † Grid Search exhausted at 216 evaluations. | ||||
| Azimuth ( ∘ ) | Probability | Azimuth ( ∘ ) | Probability |
|---|---|---|---|
| 0 | 0.03 | 180 | 0.10 |
| 30 | 0.04 | 210 | 0.12 |
| 60 | 0.05 | 240 | 0.14 |
| 90 | 0.06 | 270 | 0.18 |
| 120 | 0.07 | 300 | 0.08 |
| 150 | 0.10 | 330 | 0.03 |
| Method | SSE (mean std) | SSE med. | RMSE | Success | Best SSE | Time (s) |
|---|---|---|---|---|---|---|
| BQPhy (QIEO) | ||||||
| Optim.NelderMead [ 14 ] | ||||||
| Optim.ParticleSwarm [ 14 ] | ||||||
| BlackBoxOptim.DE [ 15 ] | ||||||
| CMA-ES [ 17 ] |
Evolutionary Optimization
Evolutionary optimization searches for strong solutions through population-based variation, selection, and adaptation.
See all 293 papers