uniqc.torch_adapter.batch_executor module¶
Batch execution utilities for quantum circuits.
Provides parallel execution of multiple circuits using ThreadPoolExecutor or multiprocessing for performance optimization.
- uniqc.torch_adapter.batch_executor.batch_execute(circuits, executor, n_workers=4)[source]¶
Execute multiple circuits in parallel.
- Parameters:
circuits – List of circuits to execute
executor – Function that executes a single circuit and returns results
n_workers – Number of parallel workers (threads)
- Returns:
List of results from each circuit execution
Example
>>> def simulate(c): ... sim = Simulator() ... return sim.simulate(c.originir) >>> results = batch_execute([c1, c2, c3], simulate, n_workers=4)
- uniqc.torch_adapter.batch_executor.batch_execute_with_params(circuit_template, param_values, executor, n_workers=4)[source]¶
Execute a circuit template with different parameter bindings.
Creates multiple bound circuits from a template and executes them in parallel.
- Parameters:
circuit_template – Circuit template with symbolic parameters
param_values – List of parameter value dictionaries to bind
executor – Function that executes a single circuit
n_workers – Number of parallel workers
- Returns:
List of results from each parameter binding
Example
>>> params = [{'theta': 0.1}, {'theta': 0.2}, {'theta': 0.3}] >>> results = batch_execute_with_params(circuit, params, simulate)