cuvec


Namecuvec JSON
Version 6.0.0 PyPI version JSON
download
home_page
SummaryUnifying Python/C++/CUDA memory: Python buffered array -> C++11 `std::vector` -> CUDA managed memory
upload_time2024-03-13 20:08:56
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMPL-2.0
keywords python c c++ buffer vector array cuda cpython swig pybind11 extensions api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            CuVec
=====

Unifying Python/C++/CUDA memory: Python buffered array ↔ C++11 ``std::vector`` ↔ CUDA managed memory.

|Version| |Downloads| |Py-Versions| |DOI| |Licence| |Tests| |Coverage|

.. contents:: Table of contents
   :backlinks: top
   :local:

Why
~~~

Data should be manipulated using the existing functionality and design paradigms of each programming language. Python code should be Pythonic. CUDA code should be... CUDActic? C code should be... er, Clean.

However, in practice converting between data formats across languages can be a pain.

Other libraries which expose functionality to convert/pass data formats between these different language spaces tend to be bloated, unnecessarily complex, and relatively unmaintainable. By comparison, ``cuvec`` uses the latest functionality of Python, C/C++11, and CUDA to keep its code (and yours) as succinct as possible. "Native" containers are exposed so your code follows the conventions of your language. Want something which works like a ``numpy.ndarray``? Not a problem. Want to convert it to a ``std::vector``? Or perhaps a raw ``float *`` to use in a CUDA kernel? Trivial.

- Less boilerplate code (fewer bugs, easier debugging, and faster prototyping)
- Fewer memory copies (faster execution)
- Lower memory usage (do more with less hardware)

Non objectives
--------------

Anything to do with mathematical functionality. The aim is to expose functionality, not (re)create it.

Even something as simple as setting element values is left to the user and/or pre-existing features - for example:

- Python: ``arr[:] = value``
- NumPy: ``arr.fill(value)``
- CuPy: ``cupy.asarray(arr).fill(value)``
- C++: ``std::fill(vec.begin(), vec.end(), value)``
- C & CUDA: ``memset(vec.data(), value, sizeof(T) * vec.size())``

Install
~~~~~~~

Requirements:

- Python 3.7 or greater (e.g. via `Anaconda or Miniconda <https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html#anaconda-or-miniconda>`_, or via ``python3-dev``)
- (optional) `CUDA SDK/Toolkit <https://developer.nvidia.com/cuda-downloads>`_ (including drivers for an NVIDIA GPU)

  * note that if the CUDA SDK/Toolkit is installed *after* CuVec, then CuVec must be re-installed to enable CUDA support

.. code:: sh

    pip install cuvec

Usage
~~~~~

See `the usage documentation <https://amypad.github.io/CuVec/#usage>`_ and `quick examples <https://amypad.github.io/CuVec/#examples>`_ of how to upgrade a Python ↔ C++ ↔ CUDA interface.

See also `NumCu <https://github.com/AMYPAD/NumCu>`_, a minimal stand-alone Python package built using CuVec.

External Projects
~~~~~~~~~~~~~~~~~

For integration into Python, C++, CUDA, CMake, pybind11, and general SWIG projects, see `the external project documentation <https://amypad.github.io/CuVec/#external-projects>`_.
Full and explicit example modules using the `CPython API <https://github.com/AMYPAD/CuVec/tree/main/cuvec/src/example_cpython>`_, `pybind11 API <https://github.com/AMYPAD/CuVec/tree/main/cuvec/src/example_pybind11>`_, and `SWIG <https://github.com/AMYPAD/CuVec/tree/main/cuvec/src/example_swig>`_ are also provided.

Contributing
~~~~~~~~~~~~

See `CONTRIBUTING.md <https://github.com/AMYPAD/CuVec/blob/main/CONTRIBUTING.md>`_.

Licence
~~~~~~~

|Licence| |DOI|

Copyright:

- `Casper O. da Costa-Luis <https://github.com/casperdcl>`_
- `Contributors <https://github.com/AMYPAD/cuvec/graphs/contributors>`_

.. |DOI| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4446211.svg
   :target: https://doi.org/10.5281/zenodo.4446211
.. |Licence| image:: https://img.shields.io/pypi/l/cuvec.svg?label=licence
   :target: https://github.com/AMYPAD/CuVec/blob/main/LICENCE
.. |Tests| image:: https://img.shields.io/github/actions/workflow/status/AMYPAD/CuVec/test.yml?branch=main&logo=GitHub
   :target: https://github.com/AMYPAD/CuVec/actions
.. |Downloads| image:: https://img.shields.io/pypi/dm/cuvec?logo=pypi&logoColor=white
   :target: https://pypi.org/project/cuvec
.. |Coverage| image:: https://codecov.io/gh/AMYPAD/CuVec/branch/main/graph/badge.svg
   :target: https://codecov.io/gh/AMYPAD/CuVec
.. |Version| image:: https://img.shields.io/pypi/v/cuvec.svg?logo=python&logoColor=white
   :target: https://github.com/AMYPAD/CuVec/releases
.. |Py-Versions| image:: https://img.shields.io/pypi/pyversions/cuvec.svg?logo=python&logoColor=white
   :target: https://pypi.org/project/cuvec

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cuvec",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "Python C C++ buffer vector array CUDA CPython SWIG pybind11 extensions API",
    "author": "",
    "author_email": "Casper da Costa-Luis <casper.dcl@physics.org>",
    "download_url": "https://files.pythonhosted.org/packages/21/85/261081078829f2458642f9c271254da4aaf0033e1b1081d849b50f950475/cuvec-6.0.0.tar.gz",
    "platform": null,
    "description": "CuVec\n=====\n\nUnifying Python/C++/CUDA memory: Python buffered array \u2194 C++11 ``std::vector`` \u2194 CUDA managed memory.\n\n|Version| |Downloads| |Py-Versions| |DOI| |Licence| |Tests| |Coverage|\n\n.. contents:: Table of contents\n   :backlinks: top\n   :local:\n\nWhy\n~~~\n\nData should be manipulated using the existing functionality and design paradigms of each programming language. Python code should be Pythonic. CUDA code should be... CUDActic? C code should be... er, Clean.\n\nHowever, in practice converting between data formats across languages can be a pain.\n\nOther libraries which expose functionality to convert/pass data formats between these different language spaces tend to be bloated, unnecessarily complex, and relatively unmaintainable. By comparison, ``cuvec`` uses the latest functionality of Python, C/C++11, and CUDA to keep its code (and yours) as succinct as possible. \"Native\" containers are exposed so your code follows the conventions of your language. Want something which works like a ``numpy.ndarray``? Not a problem. Want to convert it to a ``std::vector``? Or perhaps a raw ``float *`` to use in a CUDA kernel? Trivial.\n\n- Less boilerplate code (fewer bugs, easier debugging, and faster prototyping)\n- Fewer memory copies (faster execution)\n- Lower memory usage (do more with less hardware)\n\nNon objectives\n--------------\n\nAnything to do with mathematical functionality. The aim is to expose functionality, not (re)create it.\n\nEven something as simple as setting element values is left to the user and/or pre-existing features - for example:\n\n- Python: ``arr[:] = value``\n- NumPy: ``arr.fill(value)``\n- CuPy: ``cupy.asarray(arr).fill(value)``\n- C++: ``std::fill(vec.begin(), vec.end(), value)``\n- C & CUDA: ``memset(vec.data(), value, sizeof(T) * vec.size())``\n\nInstall\n~~~~~~~\n\nRequirements:\n\n- Python 3.7 or greater (e.g. via `Anaconda or Miniconda <https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html#anaconda-or-miniconda>`_, or via ``python3-dev``)\n- (optional) `CUDA SDK/Toolkit <https://developer.nvidia.com/cuda-downloads>`_ (including drivers for an NVIDIA GPU)\n\n  * note that if the CUDA SDK/Toolkit is installed *after* CuVec, then CuVec must be re-installed to enable CUDA support\n\n.. code:: sh\n\n    pip install cuvec\n\nUsage\n~~~~~\n\nSee `the usage documentation <https://amypad.github.io/CuVec/#usage>`_ and `quick examples <https://amypad.github.io/CuVec/#examples>`_ of how to upgrade a Python \u2194 C++ \u2194 CUDA interface.\n\nSee also `NumCu <https://github.com/AMYPAD/NumCu>`_, a minimal stand-alone Python package built using CuVec.\n\nExternal Projects\n~~~~~~~~~~~~~~~~~\n\nFor integration into Python, C++, CUDA, CMake, pybind11, and general SWIG projects, see `the external project documentation <https://amypad.github.io/CuVec/#external-projects>`_.\nFull and explicit example modules using the `CPython API <https://github.com/AMYPAD/CuVec/tree/main/cuvec/src/example_cpython>`_, `pybind11 API <https://github.com/AMYPAD/CuVec/tree/main/cuvec/src/example_pybind11>`_, and `SWIG <https://github.com/AMYPAD/CuVec/tree/main/cuvec/src/example_swig>`_ are also provided.\n\nContributing\n~~~~~~~~~~~~\n\nSee `CONTRIBUTING.md <https://github.com/AMYPAD/CuVec/blob/main/CONTRIBUTING.md>`_.\n\nLicence\n~~~~~~~\n\n|Licence| |DOI|\n\nCopyright:\n\n- `Casper O. da Costa-Luis <https://github.com/casperdcl>`_\n- `Contributors <https://github.com/AMYPAD/cuvec/graphs/contributors>`_\n\n.. |DOI| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4446211.svg\n   :target: https://doi.org/10.5281/zenodo.4446211\n.. |Licence| image:: https://img.shields.io/pypi/l/cuvec.svg?label=licence\n   :target: https://github.com/AMYPAD/CuVec/blob/main/LICENCE\n.. |Tests| image:: https://img.shields.io/github/actions/workflow/status/AMYPAD/CuVec/test.yml?branch=main&logo=GitHub\n   :target: https://github.com/AMYPAD/CuVec/actions\n.. |Downloads| image:: https://img.shields.io/pypi/dm/cuvec?logo=pypi&logoColor=white\n   :target: https://pypi.org/project/cuvec\n.. |Coverage| image:: https://codecov.io/gh/AMYPAD/CuVec/branch/main/graph/badge.svg\n   :target: https://codecov.io/gh/AMYPAD/CuVec\n.. |Version| image:: https://img.shields.io/pypi/v/cuvec.svg?logo=python&logoColor=white\n   :target: https://github.com/AMYPAD/CuVec/releases\n.. |Py-Versions| image:: https://img.shields.io/pypi/pyversions/cuvec.svg?logo=python&logoColor=white\n   :target: https://pypi.org/project/cuvec\n",
    "bugtrack_url": null,
    "license": "MPL-2.0",
    "summary": "Unifying Python/C++/CUDA memory: Python buffered array -> C++11 `std::vector` -> CUDA managed memory",
    "version": "6.0.0",
    "project_urls": {
        "Changelog": "https://github.com/AMYPAD/CuVec/releases",
        "Documentation": "https://amypad.github.io/CuVec",
        "Repository": "https://github.com/AMYPAD/CuVec"
    },
    "split_keywords": [
        "python",
        "c",
        "c++",
        "buffer",
        "vector",
        "array",
        "cuda",
        "cpython",
        "swig",
        "pybind11",
        "extensions",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2185261081078829f2458642f9c271254da4aaf0033e1b1081d849b50f950475",
                "md5": "a219dc34556ee7f7612558180dd92bda",
                "sha256": "5f0471d6a17cb653e452383bede361866065234b40fa29ae477315139e936677"
            },
            "downloads": -1,
            "filename": "cuvec-6.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a219dc34556ee7f7612558180dd92bda",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 27585,
            "upload_time": "2024-03-13T20:08:56",
            "upload_time_iso_8601": "2024-03-13T20:08:56.784146Z",
            "url": "https://files.pythonhosted.org/packages/21/85/261081078829f2458642f9c271254da4aaf0033e1b1081d849b50f950475/cuvec-6.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-13 20:08:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AMYPAD",
    "github_project": "CuVec",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cuvec"
}
        
Elapsed time: 0.20246s