pub struct SparseVectorDescriptor<'a> { /* private fields */ }Implementations§
Source§impl<'a> SparseVectorDescriptor<'a>
impl<'a> SparseVectorDescriptor<'a>
Sourcepub fn create<I: IndexTypeLike, T: DataTypeLike>(
ctx: &Context,
size: usize,
nonzero_count: usize,
indices: &'a mut DeviceMemory<I>,
values: &'a mut DeviceMemory<T>,
index_base: IndexBase,
) -> Result<Self>
pub fn create<I: IndexTypeLike, T: DataTypeLike>( ctx: &Context, size: usize, nonzero_count: usize, indices: &'a mut DeviceMemory<I>, values: &'a mut DeviceMemory<T>, index_base: IndexBase, ) -> Result<Self>
Initializes a sparse vector descriptor.
The descriptor borrows the device index and value buffers by pointer; the
buffers must outlive descriptor use or be replaced with SparseVectorDescriptor::set_values.
Sourcepub fn index_base(&self) -> Result<IndexBase>
pub fn index_base(&self) -> Result<IndexBase>
Returns the index base of this sparse vector descriptor.
§Errors
Returns an error if cuSPARSE cannot report the sparse vector index base.
Sourcepub fn values(&self) -> Result<DevicePtr>
pub fn values(&self) -> Result<DevicePtr>
Returns the values pointer of this sparse vector descriptor.
§Errors
Returns an error if cuSPARSE cannot report the values pointer.
Sourcepub fn set_values<T: DataTypeLike>(
&mut self,
values: &'a mut DeviceMemory<T>,
) -> Result<()>
pub fn set_values<T: DataTypeLike>( &mut self, values: &'a mut DeviceMemory<T>, ) -> Result<()>
Sets the values pointer of this sparse vector descriptor.
The pointed-to device buffer must remain valid while the descriptor uses it.
§Errors
Returns an error if cuSPARSE rejects the values pointer.
Sourcepub fn info(&self) -> Result<SparseVectorInfo>
pub fn info(&self) -> Result<SparseVectorInfo>
Returns the fields of this sparse vector descriptor.
§Errors
Returns an error if cuSPARSE cannot report the descriptor fields or if
reported sizes cannot be represented as usize.
pub fn as_raw(&self) -> cusparseSpVecDescr_t
pub fn as_raw_const(&self) -> cusparseConstSpVecDescr_t
pub fn cuda_context(&self) -> &Arc<CudaContext>
Sourcepub unsafe fn from_raw(
handle: cusparseSpVecDescr_t,
ctx: &Context,
) -> Result<Self>
pub unsafe fn from_raw( handle: cusparseSpVecDescr_t, ctx: &Context, ) -> Result<Self>
Wraps an existing cuSPARSE sparse-vector descriptor and takes ownership of it.
§Safety
handle must be a valid cusparseSpVecDescr_t. Any device buffers
referenced by the descriptor must remain valid for lifetime 'a.
Ownership of handle is transferred to the returned descriptor, and the
handle must not be destroyed elsewhere after calling this function.
Sourcepub fn into_raw(self) -> cusparseSpVecDescr_t
pub fn into_raw(self) -> cusparseSpVecDescr_t
Consumes the descriptor and returns the raw cuSPARSE handle without destroying it.
The caller becomes responsible for eventually destroying the returned
handle with cusparseDestroySpVec.