cuDSS Functions¶
Library Management Functions¶
cudssCreate
¶
cudssStatus_t
cudssCreate(cudssHandle_t* handle)
cudssHandle_t
) which holds the cuDSS library context.
It allocates light hardware resources on the host, and must be called prior to making any other cuDSS library calls.
Calling any cuDSS function which uses cudssHandle_t
without a previous call of cudssCreate()
will return an error.
The cuDSS library context is tied to the current CUDA device. To use the library on multiple devices, one cuDSS handle should be created for each device.Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
OUT |
cuDSS library handle |
See cudssStatus_t for the description of the return status.
cudssDestroy
¶
cudssStatus_t
cudssDestroy(cudssHandle_t handle)
cudssHandle_t
after cudssDestroy()
will return an error.Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS library handle |
See cudssStatus_t for the description of the return status.
cudssGetProperty
¶
cudssStatus_t
cudssGetProperty(libraryPropertyType propertyType,
int* value)
libraryPropertyType
for supported types.Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
|
Host |
IN |
Requested property |
|
Host |
OUT |
Value of the requested property |
libraryPropertyType
(defined in library_types.h
):
Value |
Meaning |
---|---|
|
Enumerator to query the major version |
|
Enumerator to query the minor version |
|
Number to identify the patch level |
See cudssStatus_t for the description of the return status.
cudssSetStream
¶
cudssStatus_t
cudssSetStream(cudssHandle_t* handle,
cudaStream_t stream)
Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS library handle |
|
|
Host |
IN |
The stream used by the library |
See cudssStatus_t for the description of the return status.
cudssSetDeviceMemHandler
¶
cudssStatus_t
cudssSetDeviceMemHandler(cudssHandle_t* handle,
const cudssDeviceMemHandler_t *handler)
handler
argument is set to NULL, the library handle will detach its existing memory handler from the library handle.
In case device memory handler needs to be changed after it is set for the first time, previously set device memory handler needs to be detached.device_alloc()
member of the device memory handler struct.
The allocated memory will remain a part of the cudssData_t
object used in the call until the allocated memory will be deallocated using the device_free()
member of the struct when the corresponding cudssDataDestroy() is called.
As it follows, erroneous behavior is likely to occur if the device memory handler is changed during the lifespan of the cudssData_t
objects which have
used the library handle.
See cudssDeviceMemHandler_t for further details about device_alloc()
and device_free()
.Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS library handle |
|
|
Host |
IN |
The device memory handler that encapsulates the user’s mempool. The struct content is copied internally |
See cudssStatus_t for the description of the return status.
cudssGetDeviceMemHandler
¶
cudssStatus_t
cudssGetDeviceMemHandler(cudssHandle_t* handle,
cudssDeviceMemHandler_t *handler)
Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS library handle |
|
|
Host |
OUT |
A (deep) copy of the device memory handler that encapsulates the user’s mempool (if it was set) previously via calling cudssSetDeviceMemHandler() |
See cudssStatus_t for the description of the return status.
cudssSetCommLayer
¶
cudssStatus_t
cudssSetCommLayer(cudssHandle_t handle, const char* commLibFileName)
Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS library handle |
|
|
Host |
IN |
Full filename (including path) to the cuDSS communication layer library If NULL, the communication layer library name is read from the environment variable CUDSS_COMM_LIB |
See cudssStatus_t for the description of the return status.
Config and Data Object Functions¶
cudssConfigCreate
¶
cudssStatus_t
cudssConfigCreate(cudssConfig_t* config)
cudssConfig_t
) which holds the settings of the solver relatedParameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
OUT |
cuDSS config object |
See cudssStatus_t for the description of the return status.
cudssConfigDestroy
¶
cudssStatus_t
cudssConfigDestroy(cudssConfig_t config)
Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS config object to be destroyed |
See cudssStatus_t for the description of the return status.
cudssConfigSet
¶
cudssStatus_t
cudssConfigSet(cudssConfig_t config,
cudssConfigParam_t param,
void* value,
size_t sizeInBytes)
cudssConfigParam_t
) to the specified value passed by the pointer.Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
INOUT |
cuDSS config object |
|
|
Host |
IN |
Parameter to be set |
|
Host |
IN |
A pointer to the value to be set |
|
Host |
IN |
Number of bytes to be read from the pointer |
See cudssStatus_t for the description of the return status.
cudssConfigGet
¶
cudssStatus_t
cudssConfigGet(cudssConfig_t config,
cudssConfigParam_t param,
void* value,
size_t sizeInBytes,
size_t* sizeWritten)
cudssConfigParam_t
) and saves it to the specified memory location.Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS config object |
|
|
Host |
IN |
Parameter to be retrieved from the config |
|
Host |
OUT |
A pointer to the output memory |
|
Host |
IN |
Number of bytes to be written (for verification) |
|
Host |
OUT |
Valid only when the return value is CUDSS_STATUS_SUCCESS. If |
See cudssStatus_t for the description of the return status.
cudssDataCreate
¶
cudssStatus_t
cudssDataCreate(cudssHandle_t handle, cudssData_t* data)
cudssData_t
) which holds the internal data (e.g., LU factors arrays)
as well as pointers to user-provided data related to solving a specific linear system.
To release the allocated memory, cudssDataDestroy() must be called.Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS library handle |
|
Host |
OUT |
cuDSS data object |
See cudssStatus_t for the description of the return status.
cudssDataDestroy
¶
cudssStatus_t
cudssDataDestroy(cudssHandle_t handle, cudssData_t data)
Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS library handle |
|
Host |
IN |
cuDSS data object to be destroyed |
See cudssStatus_t for the description of the return status.
cudssDataSet
¶
cudssStatus_t
cudssDataSet(cudssHandle_t handle
cudssData_t data,
cudssDataParam_t param,
void* value,
size_t sizeInBytes)
cudssDataParam_t
) to the specified value passed by the pointer.Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS library handle |
|
Host |
INOUT |
cuDSS data object |
|
|
Host |
IN |
Parameter to be set |
|
Host |
IN |
A pointer to the value to be set |
|
Host |
IN |
Number of bytes to be read from the pointer |
cudssDataGet
¶
cudssStatus_t
cudssDataGet(cudssHandle_t handle,
cudssData_t data,
cudssDataParam_t param,
void* value,
size_t sizeInBytes,
size_t* sizeWritten)
cudssDataParam_t
) and saves it to the specified memory location.Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS library handle |
|
Host |
IN |
cuDSS data object |
|
|
Host |
IN |
Parameter to be retrieved from the config |
|
Host Device |
OUT |
A pointer to the output memory |
|
Host |
IN |
Number of bytes to be written (for verification) |
|
Host |
OUT |
Valid only when the return value is CUDSS_STATUS_SUCCESS. If |
See cudssStatus_t for the description of the return status.
Main cuDSS Function¶
cudssExecute
¶
cudssStatus_t
cudssExecute(cudssHandle_t handle,
cudssPhase_t phase,
cudssConfig_t config,
cudssConfig_t data,
cudssMatrix_t* matrix,
cudssMatrix_t* solution,
cudssMatrix_t* rhs)
Parameter |
Memory |
In/Out |
Description |
Possible Values |
---|---|---|---|---|
Host |
IN |
cuDSS library handle |
||
Host |
IN |
Execution phase |
||
Host |
IN |
Solver config object |
||
Host |
INOUT |
Solver data object |
||
Host |
IN |
Input sparse matrix |
Must be sparse |
|
|
Host |
INOUT |
Solution matrix |
Must be dense |
|
Host |
IN |
Right-hand side matrix |
Must be dense |
See cudssStatus_t for the description of the return status.
Matrix Object Functions¶
cudssMatrixCreateDn
¶
cudssStatus_t
cudssMatrixCreateDn(cudssMatrix_t* matrix,
int64_t nrows,
int64_t ncols,
int64_t ld,
void* values,
cudaDataType_t valueType,
cudssLayout_t layout)
Parameter |
Memory |
In/Out |
Description |
Possible Values |
---|---|---|---|---|
Host |
OUT |
Created matrix object |
||
|
Host |
IN |
Number of rows |
Must be non-negative |
|
Host |
IN |
Number of columns |
Must be non-negative |
|
Host |
IN |
Leading dimension |
≥ nrows if column-major, ≥ ncols if row-major. The only supported values right now is exactly nrows (ncols) |
|
Device |
IN |
Values of the dense matrix |
|
|
Host |
IN |
Data type of the matrix |
|
Host |
IN |
Memory layout |
The only supported value right now is |
See cudssStatus_t for the description of the return status.
cudssMatrixCreateCsr
¶
cudssStatus_t
cudssMatrixCreateCsr(cudssMatrix_t* matrix,
int64_t nrows,
int64_t ncols,
int64_t nnz,
void* rowStart,
void* rowEnd,
void* colIndices,
void* values,
cudaDataType_t indexType,
cudaDataType_t valueType,
cudaMatrixType_t mtype,
cudaMatrixViewType_t mview,
cudssIndexBase_t indexBase)
rowStart
, rowEnd
, colIndices
and values
must hold device-visible data.Parameter |
Memory |
In/Out |
Description |
Possible Values |
---|---|---|---|---|
Host |
OUT |
Created matrix object |
||
|
Host |
IN |
Number of rows |
Must be non-negative |
|
Host |
IN |
Number of columns |
Must be non-negative |
|
Host |
IN |
Number of non-zeroes |
Must be non-negative |
|
Device |
IN |
Row start offsets |
|
|
Device |
IN |
Values of the dense matrix |
NULL is the only supported value as 4-array CSR is not supported currently |
|
Device |
IN |
Column indices of the matrix |
|
|
Device |
IN |
Values of the dense matrix |
|
|
Host |
IN |
Index type of the matrix |
|
|
Host |
IN |
Data type of the matrix |
|
Host |
IN |
Matrix type of the matrix |
||
Host |
IN |
Matrix view of the matrix |
||
Host |
IN |
Indexing base |
See cudssIndexBase_t |
See cudssStatus_t for the description of the return status.
cudssMatrixDestroy
¶
cudssStatus_t
cudssMatrixDestroy(cudssMatrix_t* matrix)
Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS matrix object |
See cudssStatus_t for the description of the return status.
cudssMatrixSetValues
¶
cudssStatus_t
cudssMatrixSetValues(cudssMatrix_t matrix, void *values)
Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS matrix object |
|
|
Device |
IN |
Buffer with the new matrix values |
See cudssStatus_t for the description of the return status.
cudssMatrixSetCsrPointers
¶
cudssStatus_t
cudssMatrixSetCsrPointers(cudssMatrix_t matrix,
void* rowStart,
void* rowEnd,
void* colIndices,
void* values)
Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS matrix object |
|
|
Device |
IN |
Buffer with the new row start offsets |
|
Device |
IN |
Buffer with the new row end offsets |
|
Device |
IN |
Buffer with the new column indices |
|
Device |
IN |
Buffer with the new matrix values |
See cudssStatus_t for the description of the return status.
cudssMatrixGetDn
¶
cudssStatus_t
cudssMatrixGetDn(cudssMatrix_t matrix,
int64_t* nrows,
int64_t* ncols,
int64_t* ld,
void** values,
cudaDataType_t* valueType,
cudssLayout_t* layout)
Parameter |
Memory |
In/Out |
Description |
Possible Values |
---|---|---|---|---|
Host |
IN |
cuDSS matrix object |
||
|
Host |
OUT |
Buffer for the number of rows |
Ignored if NULL |
|
Host |
OUT |
Buffer for the number of columns |
Ignored if NULL |
|
Host |
OUT |
Buffer for the leading dimension |
Ignored if NULL |
|
Device |
OUT |
Buffer for the values of the matrix |
Ignored if NULL |
|
Host |
OUT |
Buffer for the data type of the matrix |
Ignored if NULL |
Host |
OUT |
Buffer for the memory layout |
Ignored if NULL |
See cudssStatus_t for the description of the return status.
cudssMatrixGetCsr
¶
cudssStatus_t
cudssMatrixGetCsr(cudssMatrix_t* matrix,
int64_t* nrows,
int64_t* ncols,
int64_t* nnz,
void** rowStart,
void** rowEnd,
void** colIndices,
void** values,
cudaDataType_t* indexType,
cudaDataType_t* valueType,
cudaMatrixType_t* mtype,
cudaMatrixViewType_t* mview,
cudssIndexBase_t* indexBase)
Parameter |
Memory |
In/Out |
Description |
Possible Values |
---|---|---|---|---|
Host |
IN |
Matrix object |
||
|
Host |
OUT |
Buffer for the number of rows |
Ignored if NULL |
|
Host |
OUT |
Buffer for the number of columns |
Ignored if NULL |
|
Host |
OUT |
Buffer for the number of non-zeroes |
Ignored if NULL |
|
Device |
OUT |
Buffer for the row start offsets |
Ignored if NULL |
|
Device |
OUT |
Buffer for the values of the dense matrix |
Must be NULL as 4-array CSR is not supported |
|
Device |
OUT |
Buffer for the column indices of the matrix |
Ignored if NULL |
|
Device |
OUT |
Buffer for the values of the dense matrix |
Ignored if NULL |
|
Host |
OUT |
Buffer for the index type of the matrix |
Ignored if NULL |
|
Host |
OUT |
Buffer for the data type of the matrix |
Ignored if NULL |
Host |
OUT |
Matrix type of the matrix |
||
Host |
OUT |
Matrix view of the matrix |
||
Host |
OUT |
Buffer for the indexing base |
See cudssIndexBase_t Ignored if NULL |
See cudssStatus_t for the description of the return status.
cudssMatrixGetFormat
¶
cudssStatus_t
cudssMatrixGetFormat(cudssMatrix_t matrix, cudssMatrixFormat_t *format)
cudssMatrixFormat_t
) of the cuDSS matrix object.Parameter |
Memory |
In/Out |
Description |
---|---|---|---|
Host |
IN |
cuDSS matrix object |
|
Host |
OUT |
Buffer for the returned matrix format |
See cudssStatus_t for the description of the return status.