parallel-sort


Nameparallel-sort JSON
Version 0.2.0 PyPI version JSON
download
home_page
SummaryCython interface to parallel sorting routines
upload_time2023-08-23 22:11:13
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) [2021-2023] [Calvin Sykes] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # parallel-sort

[![Test build](https://github.com/calvin-sykes/cython_parallel_sort/actions/workflows/python-package.yml/badge.svg)](https://github.com/calvin-sykes/cython_parallel_sort/actions/workflows/python-package.yml) [![PyPI version](https://badge.fury.io/py/parallel-sort.svg)](https://badge.fury.io/py/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](https://gcc.gnu.org/onlinedocs/libstdc++/manual/parallel_mode.html) sorting routines may be used instead.

## Usage

````python
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).

On Linux, installing from wheel via `pip` should "just work":

````bash
pip install parallel_sort
````

On Mac, it is important to ensure that gcc is used to compile the module rather than the default Apple-provided clang, which can be done by prefixing the install command with `CC=$(brew --prefix gcc)/bin/gcc-13` (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:

````bash
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

````bash
CFLAGS=-mno-outline-atomics CC=$(brew --prefix gcc)/bin/gcc-13 pip install --no-cache-dir -e .
````

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "parallel-sort",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Calvin Sykes <sykescalvin09@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ee/c4/aad4ae364b4acd21bcdccc8fa7d1aa82dd0e970780e947727c60cc7455fe/parallel-sort-0.2.0.tar.gz",
    "platform": null,
    "description": "# parallel-sort\n\n[![Test build](https://github.com/calvin-sykes/cython_parallel_sort/actions/workflows/python-package.yml/badge.svg)](https://github.com/calvin-sykes/cython_parallel_sort/actions/workflows/python-package.yml) [![PyPI version](https://badge.fury.io/py/parallel-sort.svg)](https://badge.fury.io/py/parallel-sort)\n\nThis 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\").\n\nBy 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](https://gcc.gnu.org/onlinedocs/libstdc++/manual/parallel_mode.html) sorting routines may be used instead.\n\n## Usage\n\n````python\nimport parallel_sort\nimport numpy as np\n\nx = np.random.random(size=10000)\n\nx_sorted = parallel_sort.sort(x)\n\nassert np.all(np.diff(x) >= 0) # x is now sorted\n````\n\nNote that these routines are \"unstable\" sorts, meaning that the ordering of equal elements in the original array is not guaranteed to be preserved.\n\n## Installing\n\nRequirements: numpy, C++17-capable g++, Cython (only for installation from source).\n\nOn Linux, installing from wheel via `pip` should \"just work\":\n\n````bash\npip install parallel_sort\n````\n\nOn Mac, it is important to ensure that gcc is used to compile the module rather than the default Apple-provided clang, which can be done by prefixing the install command with `CC=$(brew --prefix gcc)/bin/gcc-13` (substituting your gcc version as appropriate).\n\n### GNU Parallel Mode option\n\nFor 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:\n\n````bash\npip install -e .\n````\n\nto compile and install the module.\n\n### Note for Apple Silicon Macs\n\nIf the module builds OK, but importing it fails with an error \"undefined reference to `aarch64_ldadd4_acq_rel`\", try rebuilding with the following command\n\n````bash\nCFLAGS=-mno-outline-atomics CC=$(brew --prefix gcc)/bin/gcc-13 pip install --no-cache-dir -e .\n````\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) [2021-2023] [Calvin Sykes]  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Cython interface to parallel sorting routines",
    "version": "0.2.0",
    "project_urls": {
        "Repository": "https://github.com/calvin-sykes/cython_parallel_sort.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8ca166aa10da20a07286e5f113077e178abcb8e95d9527643b590be93ebd4d9",
                "md5": "3277ac802ce49e5e870a308213654a6c",
                "sha256": "843718165bc91cedf919ac3e9ba2045714fe2a4cd67f1d3c28f3b4ea380e19d4"
            },
            "downloads": -1,
            "filename": "parallel_sort-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "3277ac802ce49e5e870a308213654a6c",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 2616932,
            "upload_time": "2023-08-23T22:15:41",
            "upload_time_iso_8601": "2023-08-23T22:15:41.242853Z",
            "url": "https://files.pythonhosted.org/packages/d8/ca/166aa10da20a07286e5f113077e178abcb8e95d9527643b590be93ebd4d9/parallel_sort-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5f26c625605d7f7eeaa380149430faf49a1fef3ca8f4a84e590c552ffe821462",
                "md5": "456996106bed28c0453d065e1ffdfea7",
                "sha256": "4628a7e9cd44e54fd61154d8fda122a7237302574367ec7e8711a3a0271f0f85"
            },
            "downloads": -1,
            "filename": "parallel_sort-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "456996106bed28c0453d065e1ffdfea7",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 2688958,
            "upload_time": "2023-08-23T22:15:43",
            "upload_time_iso_8601": "2023-08-23T22:15:43.524659Z",
            "url": "https://files.pythonhosted.org/packages/5f/26/c625605d7f7eeaa380149430faf49a1fef3ca8f4a84e590c552ffe821462/parallel_sort-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "88d1d1647b718f2d9b8eaf7608fe3da204d1589b8a355fb1cdf7351004bf6632",
                "md5": "71236b9e9273471450a21b520ca3600c",
                "sha256": "aa6f5477c7ae946466d8a05f6531b5879d8fb5f402a7f7075d40114af74004cb"
            },
            "downloads": -1,
            "filename": "parallel_sort-0.2.0-cp37-cp37m-manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "71236b9e9273471450a21b520ca3600c",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": ">=3.7",
            "size": 2552527,
            "upload_time": "2023-08-23T22:15:45",
            "upload_time_iso_8601": "2023-08-23T22:15:45.205965Z",
            "url": "https://files.pythonhosted.org/packages/88/d1/d1647b718f2d9b8eaf7608fe3da204d1589b8a355fb1cdf7351004bf6632/parallel_sort-0.2.0-cp37-cp37m-manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6fe2d4c50078ff84396e8ac543479c4b0bf8853608e127ebf9015c5a2995f3e7",
                "md5": "0083477386c155db5c9b21f4c9ce0720",
                "sha256": "8bdd2d18dc6329940437aee64a788bc507ca1614eb1ca72221e0c4cb5c5feeeb"
            },
            "downloads": -1,
            "filename": "parallel_sort-0.2.0-cp38-cp38-manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "0083477386c155db5c9b21f4c9ce0720",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 2638182,
            "upload_time": "2023-08-23T22:15:47",
            "upload_time_iso_8601": "2023-08-23T22:15:47.261700Z",
            "url": "https://files.pythonhosted.org/packages/6f/e2/d4c50078ff84396e8ac543479c4b0bf8853608e127ebf9015c5a2995f3e7/parallel_sort-0.2.0-cp38-cp38-manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "512e1e3757317b1a21b3e47e9e94ec5524c3b612bf89d3b550f0be4507291904",
                "md5": "df5c0c80a2a86d927b5f36be6beb2c37",
                "sha256": "e0fc95f644d6b159a76b1e0b3366a0c45e18846ce9fd660de5fff795fa02e9f7"
            },
            "downloads": -1,
            "filename": "parallel_sort-0.2.0-cp39-cp39-manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "df5c0c80a2a86d927b5f36be6beb2c37",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 2616255,
            "upload_time": "2023-08-23T22:15:48",
            "upload_time_iso_8601": "2023-08-23T22:15:48.735141Z",
            "url": "https://files.pythonhosted.org/packages/51/2e/1e3757317b1a21b3e47e9e94ec5524c3b612bf89d3b550f0be4507291904/parallel_sort-0.2.0-cp39-cp39-manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eec4aad4ae364b4acd21bcdccc8fa7d1aa82dd0e970780e947727c60cc7455fe",
                "md5": "9c2700dcb43f73995cba8f15fdcb95aa",
                "sha256": "3ec2d5895a1d160bf883a7a7ffd987e150d1e68c513ca1d8d951f35c94315b8d"
            },
            "downloads": -1,
            "filename": "parallel-sort-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9c2700dcb43f73995cba8f15fdcb95aa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 196973,
            "upload_time": "2023-08-23T22:11:13",
            "upload_time_iso_8601": "2023-08-23T22:11:13.192714Z",
            "url": "https://files.pythonhosted.org/packages/ee/c4/aad4ae364b4acd21bcdccc8fa7d1aa82dd0e970780e947727c60cc7455fe/parallel-sort-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-23 22:11:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "calvin-sykes",
    "github_project": "cython_parallel_sort",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "parallel-sort"
}
        
Elapsed time: 0.12617s