Divi
Divi is a Python library developed by Qoro Quantum that enables scalable, local or cloud-based execution of hybrid quantum-classical programs. It abstracts away the complexity of distributed quantum computing by automatically optimizing, parallelizing, and dispatching jobs across heterogeneous compute resources such as CPUs, GPUs, and quantum processing units (QPUs).
Whether you’re a student, researcher, or enterprise developer, Divi provides a unified interface for building and running quantum workflows that integrate classical logic, parameterized quantum circuits, and cloud resource orchestration.
Key Features
-
Automatic parallelization
Divi’s core innovation lies in its ability to transform quantum-classical programs into parallelizable units that are dispatched to Qoro’s centralized cloud system, and the same interface can be used to run locally. The distribution process itself is classical, but each unit of work typically encapsulates a part of a quantum program, for example, a parameterized quantum circuit. This architecture enables scalable experimentation, parallelized parameter sweeps, and automatic optimization execution without requiring the user to orchestrate quantum jobs manually across devices. -
Unified API for hybrid workflows
Write quantum-classical applications using Python without worrying about the backend infrastructure. -
Efficient batch job generation
Large batch programs are generated, managing program variables in an efficient way. -
Declarative program generation
Through a declarative interface, the generated quantum programs are effortlessly enhanced, optimized, and modified. Divi takes care of the applying transforms and aggregating of the outputs when needed.
Who is it for?
-
Students & Educators
Teach and learn hybrid quantum programming without needing access to specialized infrastructure. -
Researchers
Prototype and scale experiments that integrate quantum and classical components with minimal overhead. -
Enterprises
Accelerate time-to-value from quantum exploration by integrating existing compute with quantum resources.
Code Example
To execute parallelized and distributed programs from Divi, one has the option to generate the circuit batches themselves, ans simply passing them to the backend, after which they have the complete freedom to post-process the output according to the purposes of their experiments. In addition, the built-in programs can be employed for experiments based on standard quantum routines, such as VQE and QAOA, where the user only needs to include their parameters to the problem, and Divi and the rest of the stack handle the execution.
When using the cloud backend, there is no need to define the final simulators or backends used. Qoro’s stack handles it all.
To provide a better idea of what the divi interface offers, the following examples demonstrate the two use cases mentioned above. This code snippet shows how a user with fully-prepared QASM circuits can interact with the cloud API:
from divi import QoroService
service = QoroService("USER_API_KEY", shots=5000)
service.test_connection() # Test if QoroService is initialized correctly
circuits = # A dictionary mapping a circuit's user-defined label to its QASM string
job_id = service.submit_circuits(circuits)
service.poll_job_status(job_id, loop_until_complete=True)
results = service.get_job_results(job_id)
This example shows how an exploratory VQE experiment can be implemented using existing divi classes:
from divi.qprog import VQEAnsatze, VQEHyperparameterSweep
from divi.qprog.optimizers import Optimizers
from divi import QoroService
q_service = QoroService(QORO_API_KEY, shots=5000)
vqe_problem = VQEHyperparameterSweep(
symbols=["H", "H"],
coordinate_structure=[(0, 0, 0), (0, 0, 1)],
bond_lengths=list(np.linspace(0.1, 2.7, 25)),
ansatze=[VQEAnsatze.HARTREE_FOCK, VQEAnsatze.UCCSD],
max_iterations=10,
optimizer=Optimizer.MONTE_CARLO,
grouping_strategy="wires",
backend=q_service,
)
vqe_problem.create_programs()
vqe_problem.run()
vqe_problem.aggregate_results()
print(f"Total circuits: {vqe_problem.total_circuit_count}")
print(f"Simulation time: {vqe_problem.total_run_time}")
vqe_problem.visualize_results()
In the previous code, we have defined the main properties of the molecule we want to compute the ground state energy for.
Following that are the different bond lengths that we want to sweep through. Then a list of the different ansatze that we
want to use for the experiment are provided, before we define our optimizer, the maximum number of iterations we want,
and the number of shots we want to allocate for each circuit execution. In addition, we also ask divi to group
circuits together given that their observables are compatible, through the wire
grouping strategy (more on that later).
Finally, we provide the backend, which in this case is an instance of our cloud platform.
Using this simple set of arguments, 50 different VQE programs have been generated, one for each combination of bond length, and ansatz. Once the programs are executed, the users would have access to each program’s solution, and have ability to visualize them.