Tasks
Tasks are generally executed by devices. A task can be run locally or remotely. On the one hand, when running locally, your local machine will execute the task at hand and wait for the result. On the other hand, when a task is submitted to be executed on a remote device, you will obtain an object similar to a future object in async programming, which can await the result (or not).
In order to interact with a task, you’ll usually want to instantiate a device and create a new task on that device. For example,
from bloqade.pyqrack import StackMemorySimulatorfrom bloqade import squin
@squin.kerneldef main(): q = squin.qalloc(2)
squin.h(q[0]) squin.cx(q[0], q[1])
return q
sim = StackMemorySimulator(min_qubits=2)task = sim.task(main)result = task.run()