Cython interface to parallel sorting routines
Project description
parallel-sort
This module provides a simple Cython interface to parallel sorting algorithms available in C++. It provides functions for in-place and out-of-place sorts, as well as indirect sorting (aka. "argsort").
By default it requires a C++17-capable compiler, and will use the standard std::sort
routine with the parallel execution policy introduced in that standard. For older compilers without C++17 support, the GNU Parallel Mode sorting routines may be used instead.
Usage
import parallel_sort
import numpy as np
x = np.random.random(size=10000)
x_sorted = parallel_sort.sort(x)
assert np.all(np.diff(x) >= 0) # x is now sorted
Note that these routines are "unstable" sorts, meaning that the ordering of equal elements in the original array is not guaranteed to be preserved.
Installing
Requirements: numpy, C++17-capable g++, Cython (only for installation from source).
Linux
Installing from wheel via pip
should "just work":
pip install parallel_sort
To install from source, Intel TBB must first be installed via your distribution's package manager.
Mac
Wheels are not available. To install from source, Homebrew is required, with the following packages installed:
gcc
tbb
pkg-config
The module must be compiled using Homebrew's gcc, which can be done by prefixing the install command with CXX=$(brew --prefix gcc)/bin/g++-14
(substituting your gcc version as appropriate).
GNU Parallel Mode option
For older compilers that do not support C++17, the module can use the GNU Parallel Mode library instead. To build without C++17, clone the repository and set use_cxx17 = False
in setup.py
. Then run:
pip install -e .
to compile and install the module.
Note for Apple Silicon Macs
If the module builds OK, but importing it fails with an error "undefined reference to aarch64_ldadd4_acq_rel
", try rebuilding with the following command
CFLAGS=-mno-outline-atomics CXX=$(brew --prefix gcc)/bin/g++-14 pip install --no-cache-dir -e .
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
File details
Details for the file parallel_sort-0.2.1.tar.gz
.
File metadata
- Download URL: parallel_sort-0.2.1.tar.gz
- Upload date:
- Size: 206.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08718bf98c1fd2e5903170016b452c8881918520428a79aa833905c900ce243b |
|
MD5 | c9c0cdd6c05dad7f67542c16e5df05c2 |
|
BLAKE2b-256 | 6603968da23a672edbef9abca5c0a7ffe9c5a84213077bcd0d828d968ece1b76 |
File details
Details for the file parallel_sort-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: parallel_sort-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d05f8e8b5dd78ce6280bf36932b45f602c8f9f0e1cb2b4f64a4ebf8414cab29 |
|
MD5 | 6b9f4dcf1b8ac27535cd7f51006888c6 |
|
BLAKE2b-256 | 2d81a6e1b8ac450bb5d9f5a212911e0e38a88d8f66997cb83de150c5b9026183 |
File details
Details for the file parallel_sort-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: parallel_sort-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6be8bb0050853dcc5c78cb3b675656d9073b9feb767f1ecc866607f7a447e0a9 |
|
MD5 | 8fc1b2ef96e51bb9a20cda35b76bd94f |
|
BLAKE2b-256 | ae81f06e49042ed64ef5b23eec82f2b453c8eab3622ab2e5452fcd37e7140f41 |
File details
Details for the file parallel_sort-0.2.1-cp311-cp311-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: parallel_sort-0.2.1-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04002ceead64cc7254c23bbec76520243f178821173d57906f1787868b27b3f4 |
|
MD5 | a274aed7ce9adff4a33ca82449f6ba94 |
|
BLAKE2b-256 | 44535d131bb70e57d7d557f899754b2232944973bfbb10e83d175d52c40a36e4 |
File details
Details for the file parallel_sort-0.2.1-cp310-cp310-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: parallel_sort-0.2.1-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 781b73dd0bcd195856deada1016f413ae0c8557052fb40700f33521e542d5dcb |
|
MD5 | 2e2a9a7e36f64d7534003995b7565036 |
|
BLAKE2b-256 | c4c7dc9e8a5dadcd334cf9f0683aee30390218fb5b9f3f934e29f7debf8bcc86 |
File details
Details for the file parallel_sort-0.2.1-cp39-cp39-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: parallel_sort-0.2.1-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3618cff9d87fc893b4f50529a7a244b3b0d6f56bbee38cbdf8d09ef225c0668 |
|
MD5 | 17968d3411eb9d0f4eab37ca3ab21142 |
|
BLAKE2b-256 | 111aa5918ebcc6c2f102be5f66e8c08b09874632566a9f797505681aa35bf178 |
File details
Details for the file parallel_sort-0.2.1-cp38-cp38-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: parallel_sort-0.2.1-cp38-cp38-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 483371de6b53be8ab6e73698110fd2176d0bd8d9f31507f109d7ba4b51567dda |
|
MD5 | 8f50c3a9c87a8291d58601df8741d176 |
|
BLAKE2b-256 | 456d33631e5d821397d3e9c67592285cbff09ce5ca00092ff681eff2224e8c6f |
File details
Details for the file parallel_sort-0.2.1-cp37-cp37m-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: parallel_sort-0.2.1-cp37-cp37m-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.7m, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf258f7b1c454e5a0ce5e1d7ffa42f5cf30a25d81bfa71379c7cafc80cc89c46 |
|
MD5 | 6f387d789e396a1ff2a54cdf7b6328d7 |
|
BLAKE2b-256 | 6d6235eae390bf55bae43f771ee65c2b79065d03820823a37559ffe95648b2d1 |