QrEngineer APP beta 1: quantum software reengineering tool (I)
Adapter for quantum programs developed with the third-party SDK
Based on a conceptual design by QST, in 2019 we started a research project in the emerging field of Quantum Software Engineering with the aim of defining a methodological and technological environment for quantum software development. Among the main tasks of this research is the specialisation in Quantum Software Modernization. Since then, QST and aQuantum’s group of scientific researchers, composed of members of the Alarcos Group, has been working on these tasks with the aim of defining a model for the reengineering and modernization of quantum software, as well as determining the technical feasibility of developing the solutions that make this possible.
Among the most relevant tasks of this research on quantum software modernization are the following:
· Definition of KDM extensions to represent quantum systems
· Design and development of parsers for quantum programs
· Definition of UML diagram extensions for quantum information systems
· Definition of mapping between KDM and UML models
QuantumPath® is a platform designed to be agnostic. That is, to provide the user with the ability to be able to conceive quantum assets independent of the execution platform tied to a particular technology provider. This capability reduces the time and risk associated with building quantum solutions on such disruptive technologies, simplifying and increasing productivity in the process of adopting quantum computing for business. This agnosticism makes it possible for all those starting out on this wonderful quantum journey to run their solutions on multiple quantum hardware vendors – currently all the major ones, but also those that will come and/or evolve – without needing to know the specifics. But what about all those who have gained experience with precisely each of the existing vendors? They have already had to experience learning, deploying, and making a definitive commitment to a particular technology among many others… yet another situation to deal with, however many advantages it may bring. Again, the principles of modernization apply here: utilities, documentation, accelerators… in short, tools must be provided. Tools to reuse the acquired knowledge and to simplify the transfer to new and different technologies that can bring added value and even replace those initially envisaged.
For this reason, another of the outstanding features of QuantumPath® is that it has been designed and built as a solution integrator, which supports the development of algorithms and quantum apps in the most appropriate context for each solution and, through different methods and techniques, supports import/export of algorithms developed in other environments. aQuantum’s technical team tackled the no less complex task of “engineering” the results of the research, which led to the analysis, design and development of QrEngineer (Illustration 1), a QuantumPath® APP that allows different practical actions from the perspective of reengineering quantum software to adapt, with the least possible effort, algorithms developed in other environments to the QPath® architecture.
Illustration 1: Functional architecture of QrEngineer APP
The beta 1 version of QrEngineer APP contains two modules:
· Q Provider Factory, for managing quantum software adaptations developed with the SDK of other providers (which we will show in detail in this article) to make them compatible with QuantumPath®.
· Q Modernization, for the management of quantum software modernizations, which is shown in detail in the book “Quantum Software Engineering & QuantumPath®” ).
The QrEngineer APP is part of the QuantumPath® platform suite of applications. In the commercial versions of the QrEngineer APP the Administrator of each QPath® organisation will be the one who will give permission to the members of their test teams to access the APP but, to start working with the QrEngineer APP beta version 1, it is essential to have a QuantumPath® user account. If you do not have a QuantumPath® account, you will need to create a Free Developer user account.
Access to this beta 1 of the application is supported for all subscription types, including “Free Developer“.
Access to the QrEngineer APP beta 1 can be accessed from the QPath® web application itself, in the QAPPS > QrEngineer section:
Illustration 2: Access to QrEngineer APP from QuantumPath®
If you already have a QuantumPath® user account, you can also log in directly via the following link with your QPath® credentials:
By accessing the QrEngineer APP we will be able to work with the tools of the APP.
Illustration 3. QrEngineer APP homepage
Adaptation of quantum programmes developed with other vendors with QuantumPath®
Adapting quantum programs developed with the SDK of other suppliers with the QuantumPath® platform allows developers to make use of all the functionalities and advantages of the platform, without the user having to give up working with their favourite SDK. The benefits of the platform for quantum software development are demonstrated through a wide range of capabilities  made available to developers, including the following:
Originally these capabilities, which also assist in the application of best practices in quantum software engineering, were only available for solutions developed natively in QuantumPath®, although, as we have said, we have been aware that they should be extended to quantum software solutions developed on other vendors’ platforms. Let’s see below how to integrate external developments to QuantumPath® to make them work natively.
The QrEngineer APP web application offers the user an access point, with information and tutorials, to the working options that compose it at each stage of its evolution. In beta 1, the Q Provider Factory module presents the following work options:
· Q Provider Factory Python SDK:
QrEngineer SDK module that allows transpiling and executing through QuantumPath® quantum circuits developed with the SDK of other providers.
· Q Provider Factory Web UI:
Web application that provides a repository of quantum circuits and assists the user in rewriting their quantum programs for integration with QuantumPath®.
Illustration 4. Q Provider Factory homepage
Q Provider Factory Python SDK
Q Provider Factory is a Python library that allows the migration of quantum programmes developed with the SDKs of the main quantum providers to the QuantumPath® ecosystem:
· The user develops quantum programmes with their favourite software.
· Using the Q Provider Factory classes, the user can run their quantum circuits through QuantumPath®, in a large catalogue of simulators and cloud-based quantum devices from different providers.
· The user can access the QuantumPath® platform to work visually with the migrated circuits and explore the results of the different executions.
In its beta 1 version, Q Provider Factory can be used in quantum programs developed with the following Python-based libraries:
· Amazon Braket SDK
· D-Wave Ocean SDK
· Google Cirq SDK
· IBM Qiskit SDK
To work with Q Provider Factory, the QrEngineer SDK must be installed, for which the following command must be executed in a command console:
pip install QrEngineerSDK
This command will install the SDK and all its dependencies, including the QPath® Python SDK.
Using Q Provider Factory
Illustration 5. Q Provider Factory Python SDK homepage
To run a circuit through QuantumPath® using Q Provider Factory, the user has to follow the following steps:
· Editing your quantum program, written in one of the supported SDKs.
#Example of code of a specific provider : Google Cirq
cirqCircuit = cirq.Circuit()
qubits = cirq.LineQubit.range(4)
cirqCircuit.append(cirq.H(q) for q in cirq.LineQubit.range(4))
simulator = cirq.Simulator()
result = simulator.run(circuit, repetitions=20)
· Add at the beginning of it the import statement to the main SDK class.
from QrEngineerSDK import QProviderFactory
· Identify the line where the creation of the quantum circuit ends.
simulator = cirq.Simulator()
result = simulator.run(circuit, repetitions=20)
· Add the necessary code to transpile and run it through QuantumPath®:
1. Instantiate the QProviderFactory object, indicating the QuantumPath® user and its corresponding password:
qprovider = QProviderFactory(user = ‘***quantum path user***’,
passwordSHA256=’***sha-256 encrypted password***’)
2. Transpile the original circuit into a QuantumPath circuit®:
qpathCircuit = qprovider.transpileCirqCircuit(cirqCircuit)
3. Run it through QuantumPath®, providing the solution identifier, the quantum device, the namespace, the circuit name and the number of runs or samples to be performed:
qpathSolutionID = 10622
qpathDeviceID = 14
qPathCircuitName = ‘AdderCirq’
qPathNamespace = ‘Test’
qPathNumRepeats = 100
result = qprovider.executeQPathCircuit(qpathSolutionID,qpathDeviceID,qPathCircuitName,
4. Check the result of the execution and display it on the screen:
print(“Error executing the circuit” + result.error)
As QuantumPath® provides a centralised store of assets and collects all their historical telemetry, once the execution is complete, the user can access the QuantumPath® platform and visualise the circuit and flow automatically generated by the SDK in the indicated solution and check the result of the execution.
Illustration 6: Circuit generated with QrEngineer QPath® APP, as seen in QuantumPath®
Q Provider Factory Web UI
Q Provider Factory Web UI is a web tool that provides the user with a private repository for storing quantum circuits. In addition, it accelerates the integration with QuantumPath®, automating the refactoring of the original program code and writing the necessary Q Provider Factory SDK code by the user.
Access to this tool is done from the QrEngineer APP homepage, by accessing the Q Provider Factory Web link.
To complete the access, it is necessary to authenticate in the system with a QuantumPath® username and password.
Illustration 7: QrEngineer Manager authentication
Once authenticated, the application allows the user to manage a private repository of quantum circuits organised by projects.
To create a new project, the user must click on the “New Project” button and provide a name and description for the project.
Illustration 8: Creating a project
Within a project, the user can upload a new quantum circuit by clicking on the “Add a quantum circuit” button.
This will open a form where the user will have to provide the metadata of the circuit:
· Technology used for its development
· Description of the circuit
The user must also provide the source code of the circuit.
Illustration 9: Form for uploading a quantum circuit to the repository
Once the data has been provided and the “Save” button has been pressed, the system stores the circuit in the application’s database, protecting the source code by means of an advanced encryption system.
From the left panel, the user has access to all the circuits that have been uploaded to the project, being able to access their source code and delete them from the repository if necessary.
Illustration 10: Selecting a circuit from the repository and viewing its source code
Q Provider Factory Web UI allows to automatically generate the necessary code to integrate a quantum circuit from the repository with QuantumPath®.
To do it, the user must select the “Code migrations” tab and click on the “Generate code” button. This will open a form in which the user will provide the parameters for executing the circuit in QuantumPath®:
· Namespace and circuit name
· Execution device
Illustration 11: QuantumPath® migration code generation I
Thanks to the QuantumPath® agnostic model, a quantum circuit developed with a specific SDK can run on a quantum device from a different provider, if the device is registered in QuantumPath® and enabled in the solution specified by the user.
The user must then select the main file of their quantum programme and the line of code where the Q Provider Factory SDK code required to transpile and run the circuit through QuantumPath® will be inserted.
Illustration 12: QuantumPath® migration code generation II
Finally, the QrEngineer APP transpiler modifies the source code of the file and displays it to the user.
Illustration 13: QuantumPath® migration code generation III
After reviewing the generated code, the user has the option to save it in the repository, for viewing and downloading at any time.
Illustration 14: QuantumPath® migration code generation IV
QuantumPath® is an ecosystem of tools, services and processes that simplify the development of quantum algorithms integrated into industry-ready hybrid information systems.
As part of the plan to provide the industry with tools for the development of business solutions that leverage the quantum advantage, providing tools such as QrEngineer APP brings a differentiating value that our technology is already committed to. We don’t want to go it alone; we want to offer an ecosystem to companies so that they can have the best tools to apply this disruptive technology without having to wait 40 years.
QrEngineer APP beta 1 offers the first options for quantum software developers to use all the advantages of the platform without having to give up working with their favourite SDKs. One of the ways to address this challenge is to use the Q Provider Factory module for adapting quantum programs and, through its Q Provider Factory Python SDK and Q Provider Factory Web UI options, work with the access point and receive assistance in rewriting quantum programs for integration with QuantumPath®.
Working with QrEngineer APP facilitates the process of migrating algorithms developed in other environments and programming languages to QPath®. In addition to saving time, using re-engineering best practices helps preserve business knowledge, enables evolutionary maintenance of legacy information systems, and reduces development risk and costs. In addition, it extends the risk control tools that QuantumPath® has in its DNA: if the vendor’s technology changes, we can offer technology alternatives that reduce risk and therefore reduce costs and time to market, considering the state of the art going forward.
Today we present beta 1, so we can anticipate an interesting roadmap that will allow working with more SDKs and tools than those initially supported by QrEngineer APP and that will also add new features to extend the ease of use. We will keep you informed.