Skip to main content

An easy-to-use but flexible distributed quantum computing simulator.

Project description

dqc_simulator

An easy-to-use distributed quantum computing simulator

With many simulators, specifying a quantum algorithm is as easy as specifying a quantum circuit. Why can't things be as simple for distributed quantum computers (DQCs)? With dqc_simulator they can! A python package built on top of the more general quantum network simulation library NetSquid, dqc_simulator allows users to simply simulate quantum circuits on near-arbitrary, user-specifiable DQC hardware. The package aims to retain the flexibility and power of NetSquid while automatically handling some of the messier details of applying NetSquid to the DQC setting.

Key features:

  1. Easy-to-use interface for specifying distributed quantum circuits.
  2. Automatic partitioning of monolithic (single-processor) quantum circuits between quantum processing units (QPUs).
    • Arbitrary algorithms for doing this can also be specified by the user if desired, using the DQC circuit interface.
    • Circuits can be specified as a list of tuples or as a .qasm file.
  3. Automatic management of remote gates and communication qubits.
  4. Automatic compilation using pre-made compilers.
    • The user can also easily specify their own.

Requirements

  • python 3.9
  • NetSquid 1.1.7. See NetSquid.
  • NetSquid-PhysLayer 4.3.0. See link.
  • pyparsing 3.0.9

Installation instructions for users

Firstly, if you do not already have one, create a NetSquid account using the instructions here. Much of the package's functionality relies on NetSquid and so this is important to make full use of the package. However, you do not need to actually install NetSquid at this stage because it will be done automatically in the next step. At the end of the NetSquid account creation process you should have a username and password. In what follows replace <USERNAME> and <PASSWORD> with the username and password for your Netsquid account.

With a NetSquid account created, dqc_simulator and all of its dependencies can be installed with the command:

pip install --extra-index-url https://<USERNAME>:<PASSWORD>@pypi.netsquid.org dqc_simulator

where <USERNAME> and <PASSWORD> are the username and password for your NetSquid account.

Alternatively, if using uv, use the command

uv add --index https://<USERNAME>:<PASSWORD>@pypi.netsquid.org dqc_simulator

Note that the index is needed to install the NetSquid requirement. For uv this it will be necessary to include the index every time that the virtual environment is updated. So, for example when running uv add or the first uv run after adding a new dependency with uv add, even if that dependency is not needed for the package being installed.

Installation instructions for developers

To install the package from source use the command

git clone https://github.com/km-campbell/dqc_simulator.git

Then install the uv package manager onto your system.

Finally, run

uv sync --index https://<USERNAME>:<PASSWORD>@hw.ac.uk

where <USERNAME> and <PASSWORD> are the username and password for your NetSquid account from the root of the cloned repository. This will allow the build to proceed deterministically and allow you to run all code within the virtual environment included in the dqc_simulator repo. For more on this, see the uv documentation.

Note that syncing is actually done, automatically whenever you run code using uv run and so it is possible to skip this step, but uv sync is a nice check that everything is working properly.

To test that all is working as it should be, you can run:

uv run python -m unittest

Documentation

The documentation is available via readthedocs here.

Alternatively, the project documentation can be built locally by cloning the repository, as detailed above, and then using the commands

cd docs
make html

A version of the documentation will then be available in the docs/build directory. Within that directory open index.html to access the documentation.

Contributing

Contributions to dqc_simulator are very welcome. In particular, I strongly encourage users to add any useful circuit identities or circuits, gates and states to the relevant modules of the qlib subpackage, if you think that things you have made for your own work would be useful to others. In this way, we can make DQC research easier and more accessible for everyone.

Feature requests

To request a feature please create an issue with and start the issue title with the words "Feature request". I am very open to adding features that others would find useful, when I get the chance. If you believe that you could add the feature yourself, I strongly encourage you to volunteer to do so in the feature request. I will try to get back to you promptly on if I think that the feature would fit in well with dqc_simulator.

Acknowledgements

I acknowledge the use of modified code from nuqasm2 in the qasm2ast module subject to the Apache 2.0 license included above under the name LICENSE4qasm2ast_base_code. It is explicitly stated in any modules where modified nuqasm2 code is used. In my examples file, which contains some examples of how dqc_simulator can be used, I acknowledge the use of the .qasm and .inc files from the source code for MQT bench (https://github.com/munich-quantum-toolkit/bench.git). All .qasm and .inc files are sourced from there. More details about MQT bench can be found in the paper: "N Questslich, L Burgholzer and R Wille, MQT Bench: benchmarking software and design automation tools for quantum computing, Quantum, 7, 1062 (2023)".

In my examples file, which contains some examples of how dqc_simulator can be used, I acknowledge the use of the ghz_indep_qiskit_5.qasm and qelib1.inc files from the source code for MQT bench (https://github.com/munich-quantum-toolkit/bench.git). More details about MQT bench can be found in the paper: "N Questslich, L Burgholzer and R Wille, MQT Bench: benchmarking software and design automation tools for quantum computing, Quantum, 7, 1062 (2023)".

I also acknowledge the use of the processify function, which was created by schlamar and appears with minor modifications to the error handling in my dqc_simulator.util.helper module. The function is intended to be used as a workaround for a memory leak in NetSquid itself. The leak has been reported to the NetSquid developers but as NetSquid is closed source, I am unable to fix the leak myself. More info on processify is available here here. The version of processify I used was obtained from the skywalker module by dgerosa with DOI https://zenodo.org/records/15511604.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dqc_simulator-0.2.6.tar.gz (88.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dqc_simulator-0.2.6-py3-none-any.whl (100.2 kB view details)

Uploaded Python 3

File details

Details for the file dqc_simulator-0.2.6.tar.gz.

File metadata

  • Download URL: dqc_simulator-0.2.6.tar.gz
  • Upload date:
  • Size: 88.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dqc_simulator-0.2.6.tar.gz
Algorithm Hash digest
SHA256 af302f015ff1bb785500f0051294fb2559b23e8abbfcd0784d1aaaeb3251336b
MD5 0a7a6bbbea8a8cc7468fb0427a886f40
BLAKE2b-256 4ea221680e62115718a91b9ee444587baf19338b860c9a646fcf0369c7bcc41b

See more details on using hashes here.

File details

Details for the file dqc_simulator-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: dqc_simulator-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 100.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dqc_simulator-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 cb7aec9901f405dccf990ac7c525d2a62bfc777e894dbb04c1688fe7278676f8
MD5 88ad6f4b2092e1084d26f4cd9dd8a9d3
BLAKE2b-256 ba59376942b2c42c11098509da7bb6de361fb8e2ac80182b4dedda4c1c33af14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page