Skip to content

UST-QuAntiL/Quokka

Repository files navigation

Quokka

License

Quokka is an ecosystem enabling the service-based execution of quantum algorithms, in particular Variational Quantum Algorithms (VQAs). As VQAs are hybrid quantum algorithms comprising many classical and quantum tasks, a variety of services implementing these tasks are required. Thus, Quokka provides the following functionalities as services via a single Endpoint:

  1. Quantum circuit generation
  2. Quantum circuit execution
  3. Error mitigation
  4. Result analysis and objective evaluation
  5. Optimization
  6. Circuit Cutting Service
  7. Warm-Starting Service

To integrate all these services and manage the control and data flow, Quokka is best used in combination with workflows.

A video demonstrating the use of Quokka can be found on YouTube.

A comprehensive step-by-step tutorial can be found here.

Running Quokka

The easiest way to get start with Quokka is using Docker-Compose:

  1. Clone the repository using git clone https://github.com/UST-QuAntiL/Quokka.git
  2. Update the CamundaEndpoint in ip.env to http://YOUR_IP:8080/engine-rest
  3. Navigate to the repository and start it by running docker-compose up

Afterwards, Quokka is available at http://127.0.0.1:6474/

API Documentation

A description of the API Gateway uniting the Quokka services can be found here.

It contains references to all connected services. Their API specifications and examples are available via Swagger at http://127.0.0.1:SERVICE-PORT/api/swagger-ui.

Running a Workflow-based Quantum Application

Building a workflow-based quantum application is a multi-step process that starts with setting up the necessary tools for modeling the application.

Setting up the Requisites:

First, get the API gateway and all related services running by starting Quokka as described in Running Quokka

Next, a modeling tool suitable for modeling workflow-based quantum applications is required. In this example, we use the QuantME Modeling and Transformation Framework (QuantME MTF). It is based on the Camunda Modeler, a BPMN standard-compliant workflow modeler, and implements quantum-specific functionalities defined by Quantum4BPMN.

To set up the QuantME MTF, clone the repository and build the app in a Posix environment (i.e., use GitBash or WSL on Windows).

Nodejs v14 and npm v8 are required for the installation.

git clone https://github.com/UST-QuAntiL/QuantME-TransformationFramework.git
cd  QuantME-TransformationFramework

# install dependencies
npm install

# build the application to ./dist
npm run build

# or directly run the application in dev mode
npm run dev

Afterwards, the following should be shown: QuantME Transformation Framework

Open the example workflow available here using the QuantME MTF by clicking on File in the top left corner and subsequently selecting the file in the Open File... dialog.

Next, the repository endpoint for the QuantME replacement models (QRMs) must be configured, such that the quantum-specific tasks can be transformed into standard-compliant BPMN tasks before execution. Thus, click on Configuration, select the QRM Data tab and insert the values described below:

  • QRM Data tab:
    • QRM Repository User: UST-QuAntiL
    • QRM Repository Name: Quokka
    • QRM Repository Path: workflow/qrms

Afterwards, click on the Update QRMs button in the toolbar to reload the QRMs from the specified repository.

QuantME Transformation Framework

Transforming and Executing the Quantum Workflow

Before executing the workflow it has to be transformed into a BPMN standard-compliant workflow. Thus, click the Transformation button. Afterwards, all quantum-specific tasks are replaced with standard-compliant BPMN modeling elements. QuantME Transformation Framework

Next, deploy the workflow by clicking the Workflow Deployment button. Once it is successfully deployed, open the UI of the Camunda BPMN engine via: $PUBLIC_HOSTNAME:8080/camunda

First, create an account in the Camunda engine and log in. Then, the following screen is displayed: Camunda Loginscreen

Click on the home icon in the top-right corner and select Tasklist.

To instantiate the workflow model, click on Start process on the top-right and select the workflow in the pop-up menu. Next, modify the input options according to your requirements and subsequently press Start. If the quantum circuits shall be run on a quantum device or a simulated device noise model is used, valid IBMQ credentials giving access to the device must be provided. Camunda Start Process

The UI displays a notification at the bottom-right that the workflow instance was successfully started.

Afterwards, once more click on the home icon on the top-right and select Cockpit. Click on the Running Process Instance, then select the started workflow, and afterwards click on the workflow ID. Now the workflow's token flow, and the changing parameters can be observed. To see the current state of the workflow instance refresh the page. Camunda Start Process

Wait until the token reaches the final user task in the workflow, as depicted below. This might take some time, depending on the circuit size, the execution parameters, and the utilization of the selected QPU. Camunda Start Process

Afterwards, switch to the Camunda Tasklist via the home menu and click on Add a simple filter on the left. Now, the task object for the human task should be visible in the task list. Click on the task object and then on the Claim button to get the URL for the plot of the execution result. Camunda Analyze Results

Finally, click the Complete button to finish the human task, and as it is the last activity in the workflow to terminate the workflow instance.

Disclaimer of Warranty

Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.

Haftungsausschluss

Dies ist ein Forschungsprototyp. Die Haftung für entgangenen Gewinn, Produktionsausfall, Betriebsunterbrechung, entgangene Nutzungen, Verlust von Daten und Informationen, Finanzierungsaufwendungen sowie sonstige Vermögens- und Folgeschäden ist, außer in Fällen von grober Fahrlässigkeit, Vorsatz und Personenschäden, ausgeschlossen.

Acknowledgements

The initial code contribution has been supported by the project SEQUOIA funded by the Baden-Wuerttemberg Ministry of the Economy, Labour and Housing.