Intel® Quantum SDK
How to set up the Intel® Quantum SDK in qBraid
Overview
Intel® Quantum SDK is a C++ based API that allows users to write software targeted for Intel quantum hardware. It is available as a pre-installed environment on qBraid Lab, and is free to access for all users.
To cite the Intel® Quantum SDK, please reference:
Khalate, P., Wu, X.-C., Premaratne, S., Hogaboam, J., Holmes, A., Schmitz, A., Guerreschi, G. G., Zou, X. & Matsuura, A. Y., arXiv:2202.11142 (2022)
Getting Started
Select Image & Launch Lab
At the top of your account page, open the image drop down. Select the option named Intel Free 2vCPU 4GB, and then click Launch Lab.
Pulling the Intel image may take 2-3 minutes the first time. The next time you launch Lab, it will load much more quickly.
Add Python kernel
The Intel® Quantum SDK is designed to interoperate with Python software environments. To use this feature, in the
right sidebar of qBraid Lab, locate and expand the Intel® Quantum SDK environment panel and click Add Kernel.
This will create a new Python 3 kernel (marked IQSDK
), which you will use to create and run your first notebook.
Python Interface
The Intel® Quantum SDK Python Interface provides an API to run quantum algorithms using Python 3, through the intelqsdk.cbindings library.
The standard approach to using the Intel® Quantum SDK is to provide a quantum_kernel
as C++ source in your Python environment and then
expose that kernel for operation. A second approach for interacting with Python is via the Intel® Quantum Compiler OpenQASM Bridge:
-
Write
quantum_kernel
functions in C++, compile to a.so
shared object file, setup the Intel® Quantum Simulator and call theintelqsdk.cbindings
APIs from Python. -
Write quantum circuits in OpenQASM 2.0, convert that to a
quantum_kernel
source in C++, and use theintelqsdk.cbindings
library as before, all from within Python.
qBraid Specific Instructions
On qBraid, the Intel® Quantum SDK Python interface is installed in a dedicated virtual environment
with environment ID intel_dk7c2g
.
Before running a notebook, make sure that the Intel® Quantum SDK kernel is active. Then,
make sure it is enabled for the current notebook by selecting
Python [IQSDK]
in the kernel selector in the top-right of your menu bar.
For terminal users, the environment path is discoverable via the qBraid CLI as follows:
To run your Python scripts using the intelqsdk.cbindings library, active the environment:
Or, call your script directly by specifying the full path to the python3 executable:
The Intel® Quantum Compiler is also located in the same intel
environment directory.
The Intel® oneAPI toolkit also comes pre-installed on qBraid, and can be accessed at
Your First C++ Quantum Kernel
We will create and manipulate a quantum_kernel
running on the Intel® Quantum Simulator directly in your notebook. This first kernel will
demonstrate a simple quantum Bell state as a common and familiar quantum computing example.
OpenQASM Support
Intel® Quantum SDK provides a source-to-source converter which takes OpenQASM code and converts it into C++ for use with the Intel® Quantum SDK. This converter requires Python >= 3.10. Currently, it only processes OpenQASM 2.0 compliant code as described by the Open Quantum Assembly Language paper: arXiv:1707.03429.
To translate an OpenQASM source to a C++ file, you can run the Intel® Quantum Compiler with the -B flag to generate the corresponding
quantum_kernel
functions in C++ source format. If you are working from the terminal CLI with a pre-existing OpenQASM file simply
use the following syntax to create your C++ quantum_kernel
source file:
Working with inline OpenQASM content insert the following code into the above notebook, replacing the two sections there identified by comments starting with “Create ” and re-run:
As a further alternative to a OpenQASM file or an inline OpenQASM source, it is also possible to start from a Qiskit quantum algorithm and transpile to OpenQASM:
Enjoy exploring the possibilities of quantum computing with the Intel® Quantum SDK.