Get Started

Quick Start

Supported Devices

Problem Type
CSample
Dirac 1
Dirac 2
Qubo
Binary Constraint
Graph Partitioning
Community Detection
Ising Hamiltonian
Integer Hamiltonian

Qatalyst Overview

Qatalyst is a software package from Quantum Computing Inc. It provides a REST API, which can be programmed in any programming language, for example Python, Ruby or Java.
Please go to the API Reference tab for documentation on the API itself. The remainder of this document will reference the API documentation obliquely, through various code examples, primarily written in Python.

Quick Start

Installation

The qci-client package requires Python 3.9 or higher. To install from PyPI run:
1
pip install qci-client
To run jobs using the qci-client users need an active account and an API token from QCI. To request a QCI user account and a token, email support@quantumcomputinginc.com.
After obtaining your token, store it in an environment variable named QCI_TOKEN. Then set the QCI_API_URL environment variable as shown below to the URL for the Qatalyst API. These steps should be run in a terminal (shell) window:
12
export QCI_TOKEN=<your token here>
export QCI_API_URL=https://api.qci-next.com
Alternatively, you can place these lines in your .bashrc file located at ${HOME}/.bashrc.

Running a simple program

Once the client and tokens are set up, in a script or notebook import the client:
1
import qci_client as qc
In this example we demonstrate how to solve a QUBO problem. The problem can be found in the examples_python directory.

Main stages of a job

There are three main steps which we will explicitly detail below:
  1. Data conversion to JSON.
  2. Upload the data to the API. A file_id will be returned.
    1. Once uploaded, the same data can be referenced multiple times, for instance when running a parameter sweep.
  3. Construct a job body and submit the job. A job submission requires a job_type and the file_id obtained in step 1.

Details

  • First import qci_client, then initialize the QciClient class.
  • Next, load a sample QUBO file encoded in the JSON format required by the API. Each job_type requires the user to upload a file in a specific format (see Definitions).
  • After calling upload_file, we have the file_id of the uploaded file.
  • To trigger the chosen sampler to run, it needs at least one file_id in a formatted job_body plus the job_type.
  • The job_body and job_type are provided to process_job, which triggers the Qatalyst backend to solve the problem on the desired sampler (which defaults to CSample, see Parameters for additional options).
1234567891011121314151617
import qci_client as qc
import numpy as np
# Initialize the client 
client = qc.qci_client.QciClient() 
# 1. Here we load some example data, which is already in the required JSON format
qubo = np.array([[-1, 1], [1, -1]])
# 2. A file_id is return with each uploaded file. A convenience function convert NetworkX graphs and Numpy/Scipy matrices to JSON under the hood if needed 
file_response = client.upload_file(qubo, file_type="qubo") 
# 3. We show a job_body explicitly, but build_job_body is a convenience function available for this step
job_body = {
  'qubo_file_id': file_response['file_id'],
  'job_name': 'test_qubo_job', # user-defined 
  'job_tags': ['foo', 'bar'],  # user-defined list of search tags 
  'params': {'sampler_type': 'eqc1'}
} 
# trigger the job to run and wait for a response from the API 
response = client.process_job(job_body=job_body, job_type='sample-qubo')

Further details

Additional information can be found here for using the REST API in your job cycle.

Contents