cuvs.common.resources#
2 min read time
Classes#
Resources is a lightweight python wrapper around the corresponding |
Functions#
|
check_cuvs(cuvsError_t status: cuvsError_t) |
auto_sync_resources(f) |
Module Contents#
- cuvs.common.resources.check_cuvs(status: cuvsError_t)#
- check_cuvs(cuvsError_t status: cuvsError_t)
Converts a status code into an exception
- class cuvs.common.resources.Resources#
Resources is a lightweight python wrapper around the corresponding C++ class of resources exposed by RAFT’s C++ interface. Refer to the header file raft/core/resources.hpp for interface level details of this struct.
Parameters#
stream : Optional stream to use for ordering CUDA instructions
Examples#
Basic usage:
>>> from cuvs.common import Resources >>> handle = Resources() >>> >>> # call algos here >>> >>> # final sync of all work launched in the stream of this handle >>> handle.sync()
Using a cuPy stream with cuVS Resources:
>>> import cupy >>> from cuvs.common import Resources >>> >>> cupy_stream = cupy.cuda.Stream() >>> handle = Resources(stream=cupy_stream.ptr)
- static __reduce__(*args, **kwargs)#
Resources.__reduce_cython__(self)
- static __setstate__(*args, **kwargs)#
Resources.__setstate_cython__(self, __pyx_state)
- get_c_obj()#
Resources.get_c_obj(self)
Return the pointer to the underlying c_obj as a size_t
- sync()#
Resources.sync(self)
- cuvs.common.resources.auto_sync_resources(f)#
auto_sync_resources(f) Decorator to automatically call sync on a cuVS Resources object when
it isn’t passed to a function.
When a resources=None is passed to the wrapped function, this decorator will automatically create a default resources for the function, and call sync on that resources when the function exits.
This will also insert the appropriate docstring for the resources parameter