Rust-accelerated permanent computation library.
Project description
perm-rs
This library contains a Rust re-implementation of the permanent calculation function from the thewalrus module, using maturin and PyO3 to then make this callable from Python. This is then extended to support calculation across multiple processes, which offers signifcant performance improvements at large matrix sizes.
The library is mainly intended for testing how rust-enhanced modules can be developed for Python and then distributed via pypi to different platforms.
License
This software is distributed under the terms of both MIT and Apache-2.0 licenses. The permanent implementation in src/permanent.py is derrived from Apache-2.0 licensed code. See Notice for more information.
Install
Rust must first be installed if not already, the instructions for which can be found here.
Maturin is then utilised for building the rust code and generating Python bindings, this requires a virtual or conda environment. All requirements, including maturin, may be installed using the below command. This requires pip 25.1 - use pip install pip --upgrade to update to this.
(venv) pip install --group dev
Once installed, the library is built using:
(venv) maturin develop
For optimal performance, it should be built with the release profile:
(venv) maturin develop --release
UV
uv can alternatively be utilised to simplify the above process. The command uv sync will install all requirements into a virtual environment and build the library in release mode.
Benchmarking
The performance of the library can be benchmarked against thewalrus implementation using the following command:
pytest benchmark
Alternatively, a more comprehensive set of matrix sizes can be compared using the script in benchmark/generate_figure.py, also comparing the single and multi-threaded approaches. The following is the output comparison between the two libraries when run using a AMD Ryzen 9 9950x3D CPU:
There are two current trends to observe from this:
- The single-threaded case is faster than thewalrus for small matrix sizes, but trends towards similar runtimes for large n.
- The multi-threaded case is much slower at large n, due to the overhead from this which sets the minimum time to be ~1ms, but after passing a threshold at n ~ 17 becomes much faster than both thewalrus and single-threaded implementations.
The optimised case shown here, is using the
permanentfunction, which automatically selects between single & multi-threaded, based on the size of the provided unitary. This will likely not be optimal for all CPUs, but should be close enough that performance degredation is not too significant. If required, the value for which the function switches between single and multi-threading can be modified usingperm_rs.settings.multi_threading_threshold.
Plotting the relative performance of the library against thewarlus makes the above performance trends even clearer:
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file perm_rs-0.1.3.tar.gz.
File metadata
- Download URL: perm_rs-0.1.3.tar.gz
- Upload date:
- Size: 106.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d71b502f8fcea58b777c5b5cc969ae876a933c2dde93bbe187aaa8f5b1bc14ad
|
|
| MD5 |
554d76ea431747f74c7987786d29047a
|
|
| BLAKE2b-256 |
7232306b147f87077ab8560603c47501544dfca12afe6de40fc60c57146f231b
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-win_arm64.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-win_arm64.whl
- Upload date:
- Size: 204.9 kB
- Tags: CPython 3.10+, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92b1b7569543375e19c02cdf054ca57f9e5fc198d8465ccf2add3688b6587f7d
|
|
| MD5 |
9c2a701a50fa36612a826c93a6b08312
|
|
| BLAKE2b-256 |
7d3bb06c939f077815daf08064b5c116319db38e689d1c01c87a9e8ab3d9d2c6
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 216.1 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c512a991ac3a1d039509045a6b4a63fcb171d13d12e5c73fc8218c1130f4438d
|
|
| MD5 |
d81d528125b14b77295a3f6e68229f11
|
|
| BLAKE2b-256 |
3517573710d393f80f00f6c9fbb53c14633db9b933144defe69d88c3da5dbc57
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-win32.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-win32.whl
- Upload date:
- Size: 216.1 kB
- Tags: CPython 3.10+, Windows x86
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ec8ada2c878aaf63baf693ef8ba6b04a02d4eaf20f032236a1964ca40eca3fe
|
|
| MD5 |
e8359d673ebd1500d20957c1290a6a6b
|
|
| BLAKE2b-256 |
fa0054a37dd9bc68b21ebaeab6022f3ecfbb6cb28531b21f1714ef92ddc28749
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 587.0 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8b6f4d7bf5e2d7a5c902a356dfa6366cc3ac99c33764347b2796f97d127470e
|
|
| MD5 |
beff76a583ee6ad422453fac31388869
|
|
| BLAKE2b-256 |
4be88186b09241edef97e03011ae2a00141d3eb2dc38db713593aa0a80b65fb2
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-musllinux_1_2_i686.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-musllinux_1_2_i686.whl
- Upload date:
- Size: 631.1 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f71cfdf08f52b4b2005c236e60f58af190d29a9190476853fdf0adf51f333fe4
|
|
| MD5 |
8fc41e4c06f4c35df0c247f2b7172d9e
|
|
| BLAKE2b-256 |
b98a9cd2a88d834bc3507824498dab5e8e235b7888d33d62549b19f121594579
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-musllinux_1_2_armv7l.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 664.7 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e94dbe1c918d0403c9d2be4a8fefebf805674e7a33992cc606b0c546a34e36bf
|
|
| MD5 |
d1ea45ce43b34b25d3403e316a9c0684
|
|
| BLAKE2b-256 |
0b86be83427fb5a6b88cf5d959ab966fac9698651d34b09b01f6e1a4d9d7ce2f
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 550.4 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bb160140d3e9d40a51b04dbbda7794518717fbce32b23ef6d368b91fb3e1a8c
|
|
| MD5 |
50c17327993227d6cc75e6e3993c492f
|
|
| BLAKE2b-256 |
9156a902b1f74cd603ec45325e1e87c69c46f7e905fc18deb75dc970b6a75130
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 385.5 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ef66d08f9f7081ede5c31365df97a1d9bea9c4b97c65c8509d56a75d50458a0
|
|
| MD5 |
298c84e1b3dc36a632e0d85c327d13a2
|
|
| BLAKE2b-256 |
fe4ca160177877cf054489e57ced9346221b4e07bb30cd716a5d62e8caeebfa7
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 398.4 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52c3363db264ee3293deeb45a9cca8e6ffad52aeae2fa17435e4cddf625981bc
|
|
| MD5 |
cef2c47375083986c2e609542a6dcb5e
|
|
| BLAKE2b-256 |
c7ac3c27038347a2c0b55ded94d858e8e3568e25805be09c1ac95d852e30e390
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 507.5 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cadb8a6b4870f9dc2074a4e7a57ee1de699c1b7e7be1bbe3d9f5384685da6b62
|
|
| MD5 |
92e97f94e4be6bf0418054aa017e914a
|
|
| BLAKE2b-256 |
53d30a32691e06d8fc724cd1d0cd5005e6a95aa7c15aa1bccda2e44db0978729
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 417.9 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c1fc47958dfbabf96f6e874b90dbc40c2ba6a316c1a319e090583cd327dc9bd
|
|
| MD5 |
90d40b84cc0948ce82ffdd744d570a73
|
|
| BLAKE2b-256 |
7b7ae56810670c98e71f83b784421e959c32420b3937e6dea5d61ca8cae6db18
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 390.3 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c3c5063bc963b4568026a12334fc8f5a5aad20d5e8f7c3c528ab6b7a8daae5c
|
|
| MD5 |
b28b94ede5ca14b4cd07fa1f43d03b7e
|
|
| BLAKE2b-256 |
017176198d6d6620aad994e1f51d178db91a08dfb6f82d2da0c7c4d3b2f818eb
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 374.3 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e343edd50dde2ce8e721998ff0272b3d771bb5e1fb127d52684ed4ffb1b467a1
|
|
| MD5 |
26a85e955eb893c8c60575cd4088a87a
|
|
| BLAKE2b-256 |
afaef6e4e3f212a8dbe9711f29365dbdccd5f7c71d3a216dc7836086c13132c8
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 328.9 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55c4b27a69ad58b1993dd0c310293e7b109e992edfed3349dd41230f463a53ef
|
|
| MD5 |
df82d3cec61ac785ac761ef55c576471
|
|
| BLAKE2b-256 |
6ae2059750e8d423959f725bd8803fcd88a765a8314bea08ef57a877490bb9fe
|
File details
Details for the file perm_rs-0.1.3-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: perm_rs-0.1.3-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 335.9 kB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
849dd4bb5704e2cb87c4aae9d403f6b25c198bf01675ada8004180d93c3092fb
|
|
| MD5 |
1007287fec63d4cec993454c09be430f
|
|
| BLAKE2b-256 |
ab9199fecb90a5122f722ccd724e71a230f71e9ff22392ffd615c19740992a0e
|