Quantum Processing Unit (QPU)
A Quantum Processing Unit (or QPU) is, in this framework, a Python object designed to execute a Job
and return a Result
:
The
Job
defines what should be executed (e.g. quantum circuit, analog schedule, annealing Ising Hamiltonian), how to execute it (e.g. initial state, number of shots), and which information should be returned to the user (e.g. final measurement, aggregate data). The definition of aJob
is presented on the job page.The
Result
contains the output of the execution, such as measurement outputs (e.g. list of samples, average value of anObservable
), and, optionally, some information on the execution (contained in the meta-data of the Result). The definition ofResult
is presented on the result page.
A QPU can be a Quantum Emulator (a classical software emulating the behavior of a physical QPU) or a Physical system. Our framework defines 3 types of QPUs, which are:
Gate based QPUs: These QPUs execute a job containing a circuit. The
Circuit
is wrapped into a job by using the respectiveto_job()
method.Analog QPUs: These QPUs execute a job containing a schedule. The
Schedule
is wrapped into a job by using the respectiveto_job()
method.Annealing QPUs: These QPUs execute a job containing an Ising Hamiltonian. The
Ising
is wrapped into a job by using the respectiveto_job()
method.
Creating a remote QPU and accessing it
Any QPU defined in our framework can be started in server mode, and can be accessed using myQLM or from any other Qaptiva Appliance, using a synchronous connection. This section explains the creation of a server and also how to connect to a remote QPU
Any QPU has a method serve()
to start this QPU in
server mode. This method takes the PORT and the IP as arguments. For instance:
from qat.qpus import CLinalg
# Define a PORT and a IP
PORT = 1234
IP = "*"
# Define a QPU
qpu = CLinalg()
qpu.serve(PORT, IP)
If a distant QPU is started in server mode, our Framework can be used as client of
a connection.
Assuming the server is listening to the port 1234
and the ip of the server is
127.0.0.1
, RemoteQPU
can be used to connect to this server:
from qat.qpus import RemoteQPU
# Define PORT and IP
PORT = 1234
IP = "127.0.0.1"
# Define a client
qpu = RemoteQPU(PORT, IP)
Warning
The connection is synchronous, therefore, if the client is disconnected during the execution of a Batch/Job, the result of the execution would be lost
Warning
Executing a Job
(or a Batch
) on any of the available QPUs (even for custom-made ones) should be performed by calling the submit()
function (inherited from the parent class QPUHandler
) thus not circumventing any beneficial pre- or post-processing.