Divi
Divi
Divi is Qoro’s open-source Python SDK (Apache-2.0) for building and running quantum programs at scale. You describe a problem, such as a graph, a QUBO, a molecule, a Hamiltonian, or your own parameterised circuit. Divi generates the circuits, runs them in large parallel batches on a local or cloud backend, post-processes the results, and runs the classical optimisation loop around them.
📦 GitHub: QoroQuantum/divi | 📖 Reference docs: divi.readthedocs.io |
pip install qoro-divi
What Divi takes care of
- Circuit generation. It builds cost Hamiltonians from problem definitions and generates ansatz circuits, measurement groups, gradient evaluations, and error-mitigation variants from them.
- Parallel execution. Programs submit whole batches of circuits at once. Ensembles of many programs, such as the pieces of a partitioned problem or the points of a sweep, merge their circuits into a single backend job.
- Backends. The same program runs on Maestro locally, on Qiskit Aer, or on Qoro’s cloud through Composer, against simulators or QPUs. Only the
backend=argument changes. - Classical side. Optimisers, early stopping, checkpointing and resume, solution sampling, and aggregation of partitioned results.
A short example
Solve MaxCut on a graph by splitting it into clusters, running a QAOA instance per cluster, and stitching the results back together:
import networkx as nx
from divi.backends import MaestroSimulator
from divi.qprog.optimizers import ScipyMethod, ScipyOptimizer
from divi.qprog.problems import GraphPartitioningConfig, MaxCutProblem
from divi.qprog.workflows import PartitioningProgramEnsemble
graph = nx.barbell_graph(4, 0)
problem = MaxCutProblem(graph, config=GraphPartitioningConfig(max_n_nodes_per_cluster=4))
ensemble = PartitioningProgramEnsemble(
problem=problem,
n_layers=1,
backend=MaestroSimulator(), # or QoroService() to run on Qoro's cloud
optimizer=ScipyOptimizer(method=ScipyMethod.COBYLA),
max_iterations=10,
)
ensemble.run()
cut, _ = ensemble.aggregate_results()
print(ensemble.total_circuit_count, "circuits executed")In this section
- How Divi Works: programs, the circuit pipeline, ensembles, and batching.
- Backends: local simulation, and cloud execution on simulators and QPUs.
- Applications: the problem families Divi covers out of the box.