Qiskit Serverless is a user-friendly tool that enables you to easily run complex quantum computing tasks. With this software, you can execute Qiskit programs as long running jobs and distribute them across multiple CPUs, GPUs, and QPUs. This means you can take on more complex quantum-classical programs and run them with ease. You don't have to worry about configuration or scaling up computational resources, as Qiskit Serverless takes care of everything for you.
- Quickstart
- Modules
- How to Give Feedback
- Contribution Guidelines
- Deprecation Policy
- References and Acknowledgements
- License
This Quickstart section guides users to easily deploy QiskitServerless infrastructure and run a simple example. For user convenience, this section assumes that users will deploy the infrastructure in a local environment using Docker and test examples within the deployed Jupyter notebook.
-
Prepare local QiskitServerless infrastructure
-
Install Docker If Docker is not installed on your system, follow the directions on the Docker website to install Docker on your system.
-
Install qiskit-serverless on your local system (we recommend using a virtual environment).
pip install qiskit-serverless
Optional: install Jupyter Lab
pip install jupyterlab
-
Clone the Qiskit Serverless repository
git clone https://github.com/Qiskit/qiskit-serverless.git
-
Run QiskitServerless infrastructure Execute Docker Compose using the following commands.
cd qiskit-serverless/ sudo docker compose up
The output should resemble the following.
~/qiskit-serverless$ sudo docker compose --profile jupyter up [+] Running 5/0 ✔ Network public-qiskit-serverless_safe-tier Created 0.0s ✔ Container ray-head Created 0.0s ✔ Container public-qiskit-serverless-postgres-1 Created 0.0s ✔ Container gateway Created 0.0s ✔ Container scheduler Created 0.0s Attaching to gateway, public-qiskit-serverless-postgres-1, qs-jupyter, ray-head, scheduler
-
-
Launch JupyterLab environment.
cd docs/getting_started/ # the directory with sample notebooks jupyter lab
This will open the Jupyter Lab environment in your web browser.
-
Write your first example Qiskit Pattern. In the JupyterLab, create a new file,
pattern.py
, in thework
directory. You can include any arbitrary Python code in your program, or you can use the example Python file in this tutorial. -
Run the program In the JupyterLab, create a new notebook in the same directory as your program, and execute the tutorial code.
You can check the job status and get the result.
job.status() # 'DONE' job.logs() # 2023-09-21 03:48:40,286\tINFO worker.py:1329 -- Using address 172.18.0.4:6379 set in the environment variable RAY_ADDRESS\n2023-09-21 03:48:40,286\tINFO worker.py:1458 -- Connecting to existing Ray cluster at address: 172.18.0.4:6379...\n2023-09-21 03:48:40,295\tINFO worker.py:1633 -- Connected to Ray cluster. View the dashboard at \x1b[1m\x1b[32m172.18.0.4:8265 \x1b[39m\x1b[22m\n
job.status() # '{"quasi_dists": [{"1": 0.5071335183298108, "5": 0.4334908044837378, "7": 0.0593756771864515}, {"1": 0.9161860602334094, "5": 0.0838139397665906}, {"2": 0.4999999999999999, "3": 0.4999999999999999}]}'
That's all!
For more detailed examples and explanations refer to the Guide:
We encourage your feedback! You can share your thoughts with us by:
- Opening an issue in the repository
For information on how to contribute to this project, please take a look at our contribution guidelines.
This project is meant to evolve rapidly and, as such, do not follow Qiskit's deprecation policy. We may occasionally make breaking changes in order to improve the user experience. When possible, we will keep old interfaces and mark them as deprecated, as long as they can co-exist with the new ones. Each substantial improvement, breaking change, or deprecation will be documented in release notes.
[1] Qiskit
https://github.com/Qiskit/qiskit
[2] Client for IBM Qiskit Runtime
https://github.com/Qiskit/qiskit-ibm-runtime