Getting started

Qaptiva Access modes

Qaptiva Access allows any authenticated user to queue a quantum job. QLMaaS has a two modes (a server mode and a local mode), corresponding to different use cases:

In this mode, Qaptiva Access extends myQLM. myQLM users, running on their own laptops, once authenticated to the Qaptiva server, can submit quantum jobs. Any Plugins or QPUs available on Qaptiva is accessible remotely, from myQLM. Quantum jobs are queued, and result are downloadable once available. This mode requires PyPI module qlmaas and your laptop must be configured, using, for instance, the following sample of code (this sample of code creates a configuration file ~/.qlmaas/config.ini - please refer to Configuring the connection to get more information).

Configuring the connection, if your server uses a self signed certificate
from qat.qlmaas import QLMaaSConnection

# Create a first connection to the server
# ‘host’ should be the hostname or the IP address of the Qaptiva machine (as a str)
# You will be prompted for your Qaptiva username and password
connection = QLMaaSConnection(host, check_host=False)

# Create a configuration file
connection.create_config()
from qat.qlmaas import QLMaaSConnection

# Create a first connection to the server
# ‘host’ should be the hostname or the IP address of the Qaptiva machine (as a str)
# You will be prompted for your Qaptiva username and password
connection = QLMaaSConnection(host)

# Create a configuration file
connection.create_config()

Qaptiva Access provides a default Scheduler (First In First Out queuing system) which can help interactive users connected to a Qaptiva machine (typically using SSH) to queue up jobs; jobs are executed once resources are available.

Note

Qaptiva Access automatically detects you are using this mode, no additional configuration is needed. One can assume there is a configuration file in this mode (all features requiring a configuration file are enabled in this mode)

Submitting a first job

In both local and server mode, the submission of an asynchronous job would look like:

# Import a "Qaptiva Access" QPU
# (use of "qlmaas" module)

from qlmaas.qpus import LinAlg
# Import a "Qaptiva" QPU
# (use of "qat" module)

from qat.qpus import LinAlg

The rest of the code works both on myQLM (with Qaptiva Access) and directly on Qaptiva:

from qat.lang.AQASM import Program, CNOT, H

prog = Program()
qbits = prog.qalloc(2)
H(qbits[0])
CNOT(qbits)
job = prog.to_circ().to_job()

qpu = LinAlg()
result = qpu.submit(job)

With Qaptiva Access however, job submission is asynchronous. Waiting for the result to be available and obtaining it would therefore look like:

# Block process until result is available
actual_result = result.join()

# Display result
for sample in actual_result:
    print(f"{sample.state}: {sample.probability}")
# Display result
for sample in result:
    print(f"{sample.state}: {sample.probability}")