Sparse Vector APIs
The cuSPARSE helper functions for sparse vector descriptor are described in this section.
See the Sparse Vector Format section for the detailed description of the storage format.
cusparseCreateSpVec()
cusparseStatus_t
cusparseCreateSpVec(cusparseSpVecDescr_t* spVecDescr,
int64_t size,
int64_t nnz,
void* indices,
void* values,
cusparseIndexType_t idxType,
cusparseIndexBase_t idxBase,
cudaDataType valueType)
cusparseStatus_t
cusparseCreateConstSpVec(cusparseConstSpVecDescr_t* spVecDescr,
int64_t size,
int64_t nnz,
const void* indices,
const void* values,
cusparseIndexType_t idxType,
cusparseIndexBase_t idxBase,
cudaDataType valueType)
This function initializes the sparse matrix descriptor spVecDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
OUT |
Sparse vector descriptor |
|
HOST |
IN |
Size of the sparse vector |
|
HOST |
IN |
Number of non-zero entries of the sparse vector |
|
DEVICE |
IN |
Indices of the sparse vector. Array with |
|
DEVICE |
IN |
Values of the sparse vector. Array with |
|
HOST |
IN |
Enumerator specifying the data type of |
|
HOST |
IN |
Enumerator specifying the the index base of |
|
HOST |
IN |
Enumerator specifying the datatype of |
See cusparseStatus_t for the description of the return status.
cusparseDestroySpVec()
cusparseStatus_t
cusparseDestroySpVec(cusparseConstSpVecDescr_t spVecDescr) // non-const descriptor supported
This function releases the host memory allocated for the sparse vector descriptor spVecDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Sparse vector descriptor |
See cusparseStatus_t for the description of the return status.
cusparseSpVecGet()
cusparseStatus_t
cusparseSpVecGet(cusparseSpVecDescr_t spVecDescr,
int64_t* size,
int64_t* nnz,
void** indices,
void** values,
cusparseIndexType_t* idxType,
cusparseIndexBase_t* idxBase,
cudaDataType* valueType)
cusparseStatus_t
cusparseConstSpVecGet(cusparseConstSpVecDescr_t spVecDescr,
int64_t* size,
int64_t* nnz,
const void** indices,
const void** values,
cusparseIndexType_t* idxType,
cusparseIndexBase_t* idxBase,
cudaDataType* valueType)
This function returns the fields of the sparse vector descriptor spVecDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Sparse vector descriptor |
|
HOST |
OUT |
Size of the sparse vector |
|
HOST |
OUT |
Number of non-zero entries of the sparse vector |
|
DEVICE |
OUT |
Indices of the sparse vector. Array with |
|
DEVICE |
OUT |
Values of the sparse vector. Array with |
|
HOST |
OUT |
Enumerator specifying the data type of |
|
HOST |
OUT |
Enumerator specifying the the index base of |
|
HOST |
OUT |
Enumerator specifying the datatype of |
See cusparseStatus_t for the description of the return status.
cusparseSpVecGetIndexBase()
cusparseStatus_t
cusparseSpVecGetIndexBase(cusparseConstSpVecDescr_t spVecDescr, // non-const descriptor supported
cusparseIndexBase_t* idxBase)
This function returns the idxBase
field of the sparse vector descriptor spVecDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Sparse vector descriptor |
|
HOST |
OUT |
Enumerator specifying the the index base of |
See cusparseStatus_t for the description of the return status.
cusparseSpVecGetValues()
cusparseStatus_t
cusparseSpVecGetValues(cusparseSpVecDescr_t spVecDescr,
void** values)
cusparseStatus_t
cusparseConstSpVecGetValues(cusparseConstSpVecDescr_t spVecDescr,
const void** values)
This function returns the values
field of the sparse vector descriptor spVecDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Sparse vector descriptor |
|
DEVICE |
OUT |
Values of the sparse vector. Array with |
See cusparseStatus_t for the description of the return status.
cusparseSpVecSetValues()
cusparseStatus_t
cusparseSpVecSetValues(cusparseSpVecDescr_t spVecDescr,
void* values)
This function set the values
field of the sparse vector descriptor spVecDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Sparse vector descriptor |
|
DEVICE |
IN |
Values of the sparse vector. Array with |
See cusparseStatus_t for the description of the return status.