Dense Matrix APIs
The cuSPARSE helper functions for dense matrix descriptor are described in this section.
See the Dense Matrix Format section for the detailed description of the storage format.
cusparseCreateDnMat()
cusparseStatus_t
cusparseCreateDnMat(cusparseDnMatDescr_t* dnMatDescr,
int64_t rows,
int64_t cols,
int64_t ld,
void* values,
cudaDataType valueType,
cusparseOrder_t order)
cusparseStatus_t
cusparseCreateConstDnMat(cusparseConstDnMatDescr_t* dnMatDescr,
int64_t rows,
int64_t cols,
int64_t ld,
const void* values,
cudaDataType valueType,
cusparseOrder_t order)
The function initializes the dense matrix descriptor dnMatDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
OUT |
Dense matrix descriptor |
|
HOST |
IN |
Number of rows of the dense matrix |
|
HOST |
IN |
Number of columns of the dense matrix |
|
HOST |
IN |
Leading dimension of the dense matrix |
|
DEVICE |
IN |
Values of the dense matrix. Array with |
|
HOST |
IN |
Enumerator specifying the datatype of |
|
HOST |
IN |
Enumerator specifying the memory layout of the dense matrix |
cusparseCreateDnMat()
has the following constraints:
values
must be aligned to the size of the datatype specified byvalueType
. See cudaDataType_t for the description of the datatypes.
See cusparseStatus_t for the description of the return status.
cusparseDestroyDnMat()
cusparseStatus_t
cusparseDestroyDnMat(cusparseConstDnMatDescr_t dnMatDescr) // non-const descriptor supported
This function releases the host memory allocated for the dense matrix descriptor dnMatDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Dense matrix descriptor |
See cusparseStatus_t for the description of the return status.
cusparseDnMatGet()
cusparseStatus_t
cusparseDnMatGet(cusparseDnMatDescr_t dnMatDescr,
int64_t* rows,
int64_t* cols,
int64_t* ld,
void** values,
cudaDataType* type,
cusparseOrder_t* order)
cusparseStatus_t
cusparseConstDnMatGet(cusparseConstDnMatDescr_t dnMatDescr,
int64_t* rows,
int64_t* cols,
int64_t* ld,
const void** values,
cudaDataType* type,
cusparseOrder_t* order)
This function returns the fields of the dense matrix descriptor dnMatDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Dense matrix descriptor |
|
HOST |
OUT |
Number of rows of the dense matrix |
|
HOST |
OUT |
Number of columns of the dense matrix |
|
HOST |
OUT |
Leading dimension of the dense matrix |
|
DEVICE |
OUT |
Values of the dense matrix. Array with |
|
HOST |
OUT |
Enumerator specifying the datatype of |
|
HOST |
OUT |
Enumerator specifying the memory layout of the dense matrix |
See cusparseStatus_t for the description of the return status.
cusparseDnMatGetValues()
cusparseStatus_t
cusparseDnMatGetValues(cusparseDnMatDescr_t dnMatDescr,
void** values)
cusparseStatus_t
cusparseConstDnMatGetValues(cusparseConstDnMatDescr_t dnMatDescr,
const void** values)
This function returns the values
field of the dense matrix descriptor dnMatDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Dense matrix descriptor |
|
DEVICE |
OUT |
Values of the dense matrix. Array with |
See cusparseStatus_t for the description of the return status.
cusparseDnMatSetValues()
cusparseStatus_t
cusparseDnMatSetValues(cusparseDnMatDescr_t dnMatDescr,
void* values)
This function sets the values
field of the dense matrix descriptor dnMatDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Dense matrix descriptor |
|
DEVICE |
IN |
Values of the dense matrix. Array with |
cusparseDnMatSetValues()
has the following constraints:
values
must be aligned to the size of the datatype specified indnMatDescr
. See cudaDataType_t for the description of the datatypes.
See cusparseStatus_t for the description of the return status.
cusparseDnMatGetStridedBatch()
cusparseStatus_t
cusparseDnMatGetStridedBatch(cusparseConstDnMatDescr_t dnMatDescr, // non-const descriptor supported
int* batchCount,
int64_t* batchStride)
The function returns the number of batches and the batch stride of the dense matrix descriptor dnMatDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Dense matrix descriptor |
|
HOST |
OUT |
Number of batches of the dense matrix |
|
HOST |
OUT |
Address offset between a matrix and the next one in the batch |
See cusparseStatus_t for the description of the return status.
cusparseDnMatSetStridedBatch()
cusparseStatus_t
cusparseDnMatSetStridedBatch(cusparseDnMatDescr_t dnMatDescr,
int batchCount,
int64_t batchStride)
The function sets the number of batches and the batch stride of the dense matrix descriptor dnMatDescr
.
Param. |
Memory |
In/out |
Meaning |
---|---|---|---|
|
HOST |
IN |
Dense matrix descriptor |
|
HOST |
IN |
Number of batches of the dense matrix |
|
HOST |
IN |
Address offset between a matrix and the next one in the batch. |
See cusparseStatus_t for the description of the return status.