Skip to content

scottmason88/quantum-serverless

 
 

Repository files navigation

Stability License Code style: Black Python Qiskit

Quantum serverless

Quantum 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 Quantum Serverless takes care of everything for you.

diagram

Table of Contents

  1. Quickstart
  2. Modules
    1. Client
    2. Repository
    3. Charts
  3. How to Give Feedback
  4. Contribution Guidelines
  5. Deprecation Policy
  6. References and Acknowledgements
  7. License

Quickstart

This Quickstart section guides users to easily deploy QuantumServerless 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.

  1. Prepare local QuantumServerless infrastructure

    1. Install Docker If Docker is not installed on your system, follow the directions on the Docker website to install Docker on your system.

    2. Clone the Quantum Serverless repository

      git clone https://github.com/Qiskit-Extensions/quantum-serverless.git
    3. Run QuantumServerless infrastructure Execute Docker Compose using the following commands. (Note: Make sure to stop any running Jupyter Notebook servers before proceeding.)

      cd quantum-serverless/
      sudo docker compose --profile jupyter up

      The output should resemble the following.

      ~/quantum-serverless$ sudo docker compose --profile jupyter up
      [+] Running 6/0
       ✔ Container ray-head                       Created                                                   0.0s 
       ✔ Container qs-jupyter                     Created                                                   0.0s 
       ✔ Container quantum-serverless-postgres-1  Created                                                   0.0s 
       ✔ Container keycloak                       Created                                                   0.0s 
       ✔ Container gateway                        Created                                                   0.0s 
       ✔ Container scheduler                      Created                                                   0.0s 
      Attaching to gateway, keycloak, qs-jupyter, quantum-serverless-postgres-1, ray-head, scheduler
      qs-jupyter                     | Entered start.sh with args: jupyter lab
      qs-jupyter                     | Executing the command: jupyter lab
      quantum-serverless-postgres-1  | 
      quantum-serverless-postgres-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
      quantum-serverless-postgres-1  | 
      quantum-serverless-postgres-1  | 2023-09-21 11:17:09.872 UTC [1] LOG:  starting PostgreSQL 16.0 (Debian 16.0-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
      quantum-serverless-postgres-1  | 2023-09-21 11:17:09.872 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
      quantum-serverless-postgres-1  | 2023-09-21 11:17:09.872 UTC [1] LOG:  listening on IPv6 address "::", port 5432
      

      Now you can access the deployed QuantumServerless infrastructure using the built-in JupyterLab.

  2. Access the JupyterLab environment Open localhost:8888 in your web browser. The default token for the JupyterLab is 123

  3. Write your first example program In the JupyterLab, create a new file program.py in the serverless/running/source_files/ directory (Note: the directory is inside the containerized environment)

    Save this example python code.

    Now, you are ready to run the first program.

  4. Run the program In the JupyterLab, create a New Notebook and execute this python code.

    You can check the job status and get the result.

    job.status()
    # <JobStatus.SUCCEEDED: 'SUCCEEDED'>
    
    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: Deployment, Running, Development.


How to Give Feedback

We encourage your feedback! You can share your thoughts with us by:


Contribution Guidelines

For information on how to contribute to this project, please take a look at our contribution guidelines.


Deprecation Policy

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.


References and Acknowledgements

[1] Qiskit Terra
https://github.com/Qiskit/qiskit-terra

[2] Client for IBM Qiskit Runtime
https://github.com/Qiskit/qiskit-ibm-runtime


License

Apache License 2.0

About

A programming model for leveraging quantum and classical resources

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.7%
  • Smarty 2.2%
  • Other 1.1%