Skip to content

cuvec.pybind11#

Thin wrappers around cuvec_pybind11 C++/CUDA module

A pybind11-driven equivalent of the CPython Extension API-driven cpython.py

CuVec Objects#

[view source]

class CuVec(np.ndarray)

A numpy.ndarray compatible view with a cuvec member containing the underlying cuvec.cuvec_pybind11.NDCuVec_* object (for use in pybind11 API function calls).

__array_interface__#

https://numpy.org/doc/stable/reference/arrays.interface.html

__cuda_array_interface__#

[view source]

@property
def __cuda_array_interface__() -> Dict[str, Any]

https://numba.readthedocs.io/en/stable/cuda/cuda_array_interface.html

resize#

[view source]

def resize(new_shape: Shape)

Change shape (but not size) of array in-place.

zeros#

[view source]

def zeros(shape: Shape, dtype="float32") -> CuVec

Returns a cuvec.pybind11.CuVec view of a new numpy.ndarray of the specified shape and data type (cuvec equivalent of numpy.zeros).

copy#

[view source]

def copy(arr) -> CuVec

Returns a cuvec.pybind11.CuVec view of a new numpy.ndarray with data copied from the specified arr (cuvec equivalent of numpy.copy).

asarray#

[view source]

def asarray(arr, dtype=None, order=None) -> CuVec

Returns a cuvec.pybind11.CuVec view of arr, avoiding memory copies if possible. (cuvec equivalent of numpy.asarray).