Context manager for executing multiple function calls in parallel.
Any functions that you call inside the context manager will be scheduled for execution when the context manager exits. For example:
with qctrl.parallel(): result_1 = qctrl.functions.calculate_optimization(...) result_2 = qctrl.functions.calculate_optimization(...) # The functions get executed when the context manager exits, so result_1 and result_2 # do not have the results of the optimizations yet. # Once outside the context manager, the functions have been executed, so result_1 and # result_2 now contain the optimization results.
The context manager that collects function calls to be executed in parallel.
- Return type: