Skip to main content

CuVec

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

Version Downloads Py-Versions DOI Licence Tests Coverage

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.10 or greater (e.g. via Anaconda or Miniconda, or via python3-dev)

  • (optional) CUDA SDK/Toolkit (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

pip install cuvec

Usage

See the usage documentation and quick examples of how to upgrade a Python ↔ C++ ↔ CUDA interface.

See also 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. Full and explicit example modules using the CPython API, pybind11 API, and SWIG are also provided.

Contributing

See CONTRIBUTING.md.

Licence

Licence DOI

Copyright:

Metadata

Release files for cuvec 6.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cuvec 6.0.2
File Size Uploaded Provenance Actions
cuvec-6.0.2.tar.gz 27.8 kB With provenance Details for cuvec-6.0.2.tar.gz

Release files / cuvec-6.0.2.tar.gz

Download URL cuvec-6.0.2.tar.gz
Size 27.8 kB
Tags Source
SHA-256 checksum
How to use checksums
41ac892ff6ffa834142627ef6164eca5b5324e71f26bbaab542e1dbb0cc793a0
BLAKE2b-256 checksum
How to use checksums
623ae68d94c30817849ab9bcca2856355d5a045e6ec7eac758547e48aca86002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.15.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for cuvec 6.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

1 file in this release has been uploaded with provenance metadata.

Attestation for cuvec-6.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

6.0.2 This release

1 release file Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page