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.