Skip to main content

The C++ binding for the Piquasso project

Project description

PyPI Supported Python versions License CI Publish

Piquasso Boost

The Piquasso Boost library intends to improve the performance and the scaleability of the computationally most demanding components of the Piquasso bosonic quantum simulation package. The Piquasso Boost library is written in C/C++ providing a Python interface via C++ extensions. The library is equipped with the Threading Building Block (TBB) library providing an efficient task oriented parallel programming model to achieve an optimal workload balance among the accessible execution units of the underlying hardware avoiding any over-subscription of the resources. Thus, the parallelized components of the Piquasso Boost library can be freely combined with each other without the cost of performance drop-down.

The Piquasso Boost library utilizes recently developed algorithms to ensure the most favorable scaling of the number of the floating point operations (FLOPS) with the problem size. In order to reduce the computational time to the minimum we designed the structure of the code to also keep the number of memory operations (MEMOPS) as low as possible by the reuse of the data already loaded into the cache-line hierarchy of the CPU units whenever it is possible. The register level parallelism via portable SIMD instruction are provided by the implementation of low level BLAS kernels in calculations involving double precision floating point representation.

When it comes to large scaled problems (for example boson sampling simulations involving 20-30 or more photons) the necessary computational precision is ensured by a mixture of double and extended precision floating point operations while keeping the running time as low as possible. The numerical stability of the library obtained by mixing different precision floating point representations is governed by heuristically determined internal parameters. Also, the interplay of MPI and TBB parallel libraries implemented in the Piquasso Boost library (the compilation of the library with MPI support is optional) provides a high scaleability in HPC environments allowing to spawn heavy computational tasks across several cluster nodes.

The present package is supplied with Python building script and CMake tools to ease its deployment. The Piquasso Boost library package can be built with both Intel and GNU compilers, and can be link against various CBLAS libraries installed on the system. (So far OpenBLAS and the Intel MKL packages were tested.) In the following we briefly summarize the steps to build, install and use the Piquasso Boost library.

Installation

The intended end-user installation path is:

$ pip install piquassoboost

The piquassoboost package name has been reserved for the upcoming PyPI release. Until the first release is published, or on platforms where a prebuilt wheel is not yet available, install from source using the manual build steps below.

Piquasso Boost depends on piquasso==5.0.0, which is installed automatically by pip.

The project was supported by the Ministry of Innovation and Technology and the National Research, Development and Innovation Office within the Quantum Information National Laboratory of Hungary.

Citation

If you use Piquasso Boost in your research, please cite:

Morse, Gregory; Rybotycki, Tomasz; Kaposi, Ágoston; Kolarovszki, Zoltán; Stojčić, Uros; Kozsik, Tamás; Mencer, Oskar; Oszmaniec, Michał; Zimborás, Zoltán; Rakyta, Péter. High performance Boson sampling simulation via data-flow engines. New Journal of Physics 26(3), 033033 (2024).

For the Piquasso photonic quantum computing framework that Piquasso Boost accelerates, please also cite:

Kolarovszki, Zoltán; Rybotycki, Tomasz; Rakyta, Péter; Kaposi, Ágoston; Poór, Boldizsár; Jóczik, Szabolcs; Nagy, Dániel T. R.; Varga, Henrik; El-Safty, Kareem H.; Morse, Gregory; Oszmaniec, Michał; Kozsik, Tamás; Zimborás, Zoltán. Piquasso: A Photonic Quantum Computer Simulation Software Platform. Quantum 9, 1708 (2025).

For the recursive Torontonian and loop-Torontonian algorithms, please also cite:

Kaposi, Ágoston; Kolarovszki, Zoltán; Kozsik, Tamás; Zimborás, Zoltán; Rakyta, Péter. Polynomial speedup in Torontonian calculation by a scalable recursive algorithm (2021).

Contact Us

Have a question about the Piquasso Boost library? Don't hesitate to contact us by creating a new issue or directly at the following e-mails:

Dependencies

The dependencies necessary to compile and build the Piquasso Boost library from source are the followings:

The Python interface of the Piquasso Boost library needs the following packages to be installed on the system:

  • scikit-build (>=0.11.1)
  • Numpy (>=1.19.4)
  • scipy (>=1.5.2)
  • quantum-blackbird (==0.2.3)
  • theboss (>=2.0.3)
  • tbb-devel
  • mpi4py
  • pytest
  • piquasso

Note: In some distributions, OpenBLAS might not come with CBLAS, it might be needed to install CBLAS manually.

Source build

Use the source build path for local development, editable installs, unpublished branches, or platforms where pip install piquassoboost needs to build from source.

Download the source of the Piquasso Boost library

The developer version of the Piquasso Boost library can be cloned from GitHub repository. After the Piquasso Boost repository is extracted into the directory path/to/piquasso_boost/library (which would be the path to the source code of the Piquasso Boost library), one can proceed to the compilation steps described in the next section.

Initialize Piquasso submodule

In case the Piquasso Boost library was cloned from GitHub repositories, the first step is to activate the piquasso submodule by git commands (The piquasso submodule provides the high level Python API of the Piquasso project.):

$ git submodule init

$ git submodule update

The commands above initialize and pull down the piquasso submodule from GitHub sources.

Setting up environment variables

The Piquasso Boost library is equipped with a Python build script and CMake tools to ease the compilation and the deployment of the package. These scripts automatically finds all library dependencies needed to compile Piquasso Boost. The Piquasso Boost library is parallelized via Threading Building Block (TBB) libraries. The most straightforward way to get TBB development package installed on the system is to install the python package tbb-devel containing the most recent version of the TBB library (including the header files). (The tbb-devel package can be installed in any python virtual environment, thus it is not needed to have administration privileges to have it.)
If the TBB library is already present on the system (for example it was installed via the apt utility (sudo apt install libtbb-dev) or it was downloaded and built from source from https://github.com/oneapi-src/oneTBB) and the user wants to use this version of the TBB library, it is possible by (optionally) setting the

$ export TBB_LIB_DIR=path/to/TBB/lib(64)

$ export TBB_INC_DIR=path/to/TBB/include

environment variables. The building script will look for TBB libraries and header files on the paths given by these environment variables.

CBLAS and LAPACK libaraies are another dependencies necessary to use the Piquasso Boost library. Since it is advised to have numpy linked against such a library (for example anaconda automatically brings numpy linked against Intel MKL or OpenBLAS) the building script will automatically find out the location of this library. (To check whether there is any CBLAS libarary behind numpy use commands import numpy as np and np.show_config() inside a python interpreter and check the given library locations.) If there is no BLAS behind numpy, one can install system wide OpenBLAS by command

$ sudo apt-get install libopenblas-dev liblapack-dev liblapacke-dev

If one don't have administration privileges it is possible to build OpenBLAS (including LAPACK and LAPACKE interfaces) from source (for details see OpenBLAS) and set the environment variable

$ export BLAS_LIB_DIR=path/to/OpenBLAS/lib(64)

to give a hint for the building scripts where to look for the OpenBLAS library.

The Piquasso Boost library can also deployed with MPI support to run large scaled calculations in HPC environments. The python package mpi4py provides the necessary dependencies for the MPI support (which also checks for system wide MPI libraries) In order to enable the MPI support one should define the

$ export PIQUASSOBOOST_MPI=1

environment variable in prior the build. The Piquasso Boost library is supported with AVX/AVX2 and AVX512F kernels. The underlying architecture is determined automatically by building scripts, however the library provides a control switch to compile against AVX512F kernels when it is possible. The AVX152 kernels provide 10-15% speedup at the same CPU clock speed, however, since AVX512 mode usually locks down the CPU clock speed, in overall AVX512F kernels would perform slower than the AVX/AVX2 kernel, if they are not limited by CPU clock speed lock. To check AVX512 capability during compilation and build the code against AVX512F kernels one need to define the

$ export USE_AVX512=1

environment variable. Finally, in order to build Piquasso Boost library including the C test files define the

$ export PIQUASSOBOOST_CTEST=1

environment variable before compiling the library.

Developer build

We recommend installing the Piquasso Boost package in an Anaconda environment for local development. In order to install the necessary requirements, follow the steps below:

Creating new python environment:

$ conda create -n pqboost python=3.10

Activate the new anaconda environment

$ conda activate pqboost

Install dependencies:

$ conda install numpy scipy pip pytest scikit-build tbb-devel tensorflow ninja

$ pip install quantum_blackbird theboss==2.0.3

For running pytest examples one should also install the Strawberry Fields package:

$ pip install strawberryfields

To initialize the correct piquasso package for interfacing with python issue the following commands:

$ git submodule init

$ git submodule update

After the basic environment variables are set and the dependencies are installed, the compilation of the package can be started by the Python command:

$ python3 setup.py build_ext

The command above starts the compilation of the Piquasso Boost C++ library and builds the necessary Python interface extensions in place. After a successful build, one can register the Piquasso Boost package in the Python distribution in developer (i.e. editable) mode by command:

$ python -m pip install -e .

Binary distribution

This section is primarily for maintainers preparing release artifacts. End users should prefer pip install piquassoboost once wheels are published on PyPI.

After the environment variables are set it is possible to build the Piquasso Boost binaries. In order to launch the compilation process from python, scikit-build package is necessary. (It is optional to install the ninja package which speeds up the building process by parallel compilation.) The binary wheel can be constructed by command

$ python3 setup.py bdist_wheel

in the root directory of the Piquasso Boost library. (It is also possible to compile Piquasso Boost package without creating binary wheel with the command python setup.py build_ext) The created Piquasso Boost wheel can be installed on the local machine by issuing the command from the directory path/to/piquasso_boost/library/dist

$ pip3 install piquassoboost-*.whl

We notice, that the created wheel is not portable, since it contains hard coded link to external libraries (TBB and CBLAS).

Source distribution

A portable source distribution of the Piquasso Boost library can be created by a command launched from the root directory of the Piquasso Boost package:

$ python3 setup.py sdist

In order to create a source distribution it is not necessary to set the environment variables, since this script only collects the necessary files and pack them into a tar ball located in the directory path/to/piquasso_boost/library/dist. In order to install the Piquasso Boost package from source tar ball, see the previous section discussing the initialization of the environment variables. The package can be compiled and installed by the command

$ pip3 install piquassoboost-*.tar.gz

issued from directory path/to/piquasso_boost/library/dist (It is optional to install the ninja package which speeds up the building process by parallel compilation.)

Test the Piquasso Boost library

After a succesfull intallation of the Piquasso Boost library one can test its functionalities by calling the tests scripts

$ pytest tests

and

$ pytest -s performance_tests

issued in the root directory of the Piquasso Boost library.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

piquassoboost-0.3.3-cp313-cp313-win_amd64.whl (9.1 MB view details)

Uploaded CPython 3.13Windows x86-64

piquassoboost-0.3.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (13.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

piquassoboost-0.3.3-cp313-cp313-macosx_15_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

piquassoboost-0.3.3-cp312-cp312-win_amd64.whl (9.1 MB view details)

Uploaded CPython 3.12Windows x86-64

piquassoboost-0.3.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (13.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

piquassoboost-0.3.3-cp312-cp312-macosx_15_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

piquassoboost-0.3.3-cp311-cp311-win_amd64.whl (9.1 MB view details)

Uploaded CPython 3.11Windows x86-64

piquassoboost-0.3.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (13.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

piquassoboost-0.3.3-cp311-cp311-macosx_15_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

piquassoboost-0.3.3-cp310-cp310-win_amd64.whl (9.1 MB view details)

Uploaded CPython 3.10Windows x86-64

piquassoboost-0.3.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (13.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

piquassoboost-0.3.3-cp310-cp310-macosx_15_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file piquassoboost-0.3.3-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 67a7737b1083387b488bb4a79a50525b2b0d349d67fa1047f1f2c58cd3211c47
MD5 9f7e5e40aecab88989546a2f20e6d854
BLAKE2b-256 9967383324c23a67d9b55eff5634debc81003a777424200f6c3912ee5a024fce

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c29a6b0c37ff3eb69cdf63aaf7c6764d40e129c7d77bbafb0ac12b661081e33a
MD5 0fe71e0f912f4e115c7943cd5d02ad96
BLAKE2b-256 6278e343632681ca26e232e938af7debf0321c6d7b532a8f8fcea7923c7038ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 150b193ded42d64eb22f1766bdebb96b8fa3eb95310cea1fe93dac168adb1015
MD5 6eeb1062df99440aecb4322ce16a8fde
BLAKE2b-256 d2b5678c706c4c94eac870546aca72438bc42ffabcdf8243eccb61e08fa81f5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp313-cp313-macosx_15_0_arm64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 44ea8ef692ddc5a7c32ef41abf3603079257ab5f4817eb499049d40c654fb3ac
MD5 48abedd6932bb790a3d0059771bc12b0
BLAKE2b-256 51c5ee1da6cdf669c301b12addae79a2d7d6ee1812f6c006bc23fe21e4cdfaaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f2a45a2fa9238f836598e828dd85a69fd8ebd0614a621c081132ce565af9c879
MD5 e1b8ade567cb074e4e532360b0e6a42b
BLAKE2b-256 ba06c52fbefaa6ef79373098442240eafc0035333c2f554cd83c3db9dd0beac6

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 7b646c3ae8b846b8926eb97f0a3b27b9a4e927039c6077ff904d661dde3fcc5a
MD5 5df1d34feb5952c2af89e56289a1dddb
BLAKE2b-256 eeffa76403c18eb24aeb6fad6b2be058e3d60765ae26f92b6a5a1000bf68c8cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2b1d2f5579090e30e1a891f671705e434bda1a55f58ed6d2f99cdebacf2ba89c
MD5 319309a6c78e47405613e8fc89ac51a6
BLAKE2b-256 034f7a8f748823349e52350210d737a4a0f968d525c3640cac2cce694db11712

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b422ca4bcfeb903f2a16e03a1015dad58ee5520da3977d82342891dc0d24c0cc
MD5 e9eb1fe8019f0b3dc039e456d68b8c6a
BLAKE2b-256 d736728e450f7823dcb156cff3dbc0d6adc4ae5cafb4ce6dd42ce9e95d54148a

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 22177dcbfb215929be4fd8d0d1fcfc8a32341cc3843a249dca1971005a27812c
MD5 c2e7f300a24e618ebee63536cfd96c21
BLAKE2b-256 7eb8f160d51bb44b129b59e2fef64667b17acbdb88cf2913e8ea256b84adc8ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp311-cp311-macosx_15_0_arm64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9ee624744233a8552c131527530bd77029169b57a4017590592c4a0f73ae411a
MD5 1f439893363078fc2bc47272b25907e6
BLAKE2b-256 05efa52a91108942c6bd7fb1d9a454600b1706920fa51708454616f56b7d0b0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 68b7b74855015207cd0be4d6286c1f80df9bd0c3f15b71cd9ea01b186a7eb52d
MD5 54d4ea95d52ffe89b98b129e638c762f
BLAKE2b-256 1b476e48711f6215cb483023163911fe9977cddc63556ac86c66e48ca39b9f03

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piquassoboost-0.3.3-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for piquassoboost-0.3.3-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 956088e5ab13f296503ebf998a079332a7865282104e574288f02d2ca2bcf007
MD5 6d62fee347a33c68d4f0b1a680176b49
BLAKE2b-256 d36f9e3a19d716653f03c82557a83c342bce416c21fcf085d5e8739b82e15991

See more details on using hashes here.

Provenance

The following attestation bundles were made for piquassoboost-0.3.3-cp310-cp310-macosx_15_0_arm64.whl:

Publisher: publish.yml on Budapest-Quantum-Computing-Group/piquassoboost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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