Dense Vector APIs

The cuSPARSE helper functions for dense vector descriptor are described in this section.

See the Dense Vector Format section for the detailed description of the storage format.


cusparseCreateDnVec()

cusparseStatus_t
cusparseCreateDnVec(cusparseDnVecDescr_t* dnVecDescr,
                    int64_t               size,
                    void*                 values,
                    cudaDataType          valueType)

cusparseStatus_t
cusparseCreateConstDnVec(cusparseConstDnVecDescr_t* dnVecDescr,
                         int64_t                    size,
                         const void*                values,
                         cudaDataType               valueType)

This function initializes the dense vector descriptor dnVecDescr.

Param.

Memory

In/out

Meaning

dnVecDescr

HOST

OUT

Dense vector descriptor

size

HOST

IN

Size of the dense vector

values

DEVICE

IN

Values of the dense vector. Array with size elements

valueType

HOST

IN

Enumerator specifying the datatype of values

See cusparseStatus_t for the description of the return status.


cusparseDestroyDnVec()

cusparseStatus_t
cusparseDestroyDnVec(cusparseConstDnVecDescr_t dnVecDescr) // non-const descriptor supported

This function releases the host memory allocated for the dense vector descriptor dnVecDescr.

Param.

Memory

In/out

Meaning

dnVecDescr

HOST

IN

Dense vector descriptor

See cusparseStatus_t for the description of the return status.


cusparseDnVecGet()

cusparseStatus_t
cusparseDnVecGet(cusparseDnVecDescr_t dnVecDescr,
                 int64_t*             size,
                 void**               values,
                 cudaDataType*        valueType)

cusparseStatus_t
cusparseConstDnVecGet(cusparseConstDnVecDescr_t dnVecDescr,
                      int64_t*                  size,
                      const void**              values,
                      cudaDataType*             valueType)

This function returns the fields of the dense vector descriptor dnVecDescr.

Param.

Memory

In/out

Meaning

dnVecDescr

HOST

IN

Dense vector descriptor

size

HOST

OUT

Size of the dense vector

values

DEVICE

OUT

Values of the dense vector. Array with nnz elements

valueType

HOST

OUT

Enumerator specifying the datatype of values

See cusparseStatus_t for the description of the return status.


cusparseDnVecGetValues()

cusparseStatus_t
cusparseDnVecGetValues(cusparseDnVecDescr_t dnVecDescr,
                       void**               values)

cusparseStatus_t
cusparseConstDnVecGetValues(cusparseConstDnVecDescr_t dnVecDescr,
                            const void**              values)

This function returns the values field of the dense vector descriptor dnVecDescr.

Param.

Memory

In/out

Meaning

dnVecDescr

HOST

IN

Dense vector descriptor

values

DEVICE

OUT

Values of the dense vector

See cusparseStatus_t for the description of the return status.


cusparseDnVecSetValues()

cusparseStatus_t
cusparseDnVecSetValues(cusparseDnVecDescr_t dnVecDescr,
                       void*                values)

This function set the values field of the dense vector descriptor dnVecDescr.

Param.

Memory

In/out

Meaning

dnVecDescr

HOST

IN

Dense vector descriptor

values

DEVICE

IN

Values of the dense vector. Array with size elements

See cusparseStatus_t for the description of the return status.