clSPARSE  v0.10.0.0
a software library containing Sparse functions written in OpenCL
Classes | Macros | Typedefs | Enumerations | Functions
clSPARSE.h File Reference

clSPARSE.h defines 'C' compatible callable functions and types that call into the library More...

#include "clsparse_export.h"
#include "clSPARSE-1x.h"

Go to the source code of this file.

Classes

struct  clsparseCreateResult
 A structure returned by value from the clsparseCreateControl function. This serves as result/status pair for the creation operation. More...
 
struct  clsparseEventResult
 A structure returned by value from the clsparseGetEvent function. This serves as result/status pair for the creation operation. More...
 
struct  clsparseCreateSolverResult
 A structure returned by value from the clsparseCreateSolverControl function. This serves as result/status pair for the creation operation. More...
 
struct  clsparseMetaSizeResult
 A structure returned by value from the clsparseCsrMetaSize function. This serves as a result/status pair for the size of the meta data associated with a sparse matrix. More...
 

Typedefs

typedef struct _clsparseControl * clsparseControl
 clsparseControl keeps OpenCL state like kernel execution, memory allocation and synchronization behavior More...
 

Enumerations

enum  clsparseStatus {
  clsparseSuccess = CL_SUCCESS,
  clsparseInvalidValue = CL_INVALID_VALUE,
  clsparseInvalidCommandQueue = CL_INVALID_COMMAND_QUEUE,
  clsparseInvalidContext = CL_INVALID_CONTEXT,
  clsparseInvalidMemObject = CL_INVALID_MEM_OBJECT,
  clsparseInvalidDevice = CL_INVALID_DEVICE,
  clsparseInvalidEventWaitList = CL_INVALID_EVENT_WAIT_LIST,
  clsparseInvalidEvent = CL_INVALID_EVENT,
  clsparseOutOfResources = CL_OUT_OF_RESOURCES,
  clsparseOutOfHostMemory = CL_OUT_OF_HOST_MEMORY,
  clsparseInvalidOperation = CL_INVALID_OPERATION,
  clsparseCompilerNotAvailable = CL_COMPILER_NOT_AVAILABLE,
  clsparseBuildProgramFailure = CL_BUILD_PROGRAM_FAILURE,
  clsparseInvalidKernelArgs = CL_INVALID_KERNEL_ARGS,
  clsparseNotImplemented = -1024,
  clsparseNotInitialized,
  clsparseStructInvalid,
  clsparseInvalidSize,
  clsparseInvalidMemObj,
  clsparseInsufficientMemory,
  clsparseInvalidControlObject,
  clsparseInvalidFile,
  clsparseInvalidFileFormat,
  clsparseInvalidKernelExecution,
  clsparseInvalidType,
  clsparseInvalidSolverControlObject = -2048,
  clsparseInvalidSystemSize,
  clsparseIterationsExceeded,
  clsparseToleranceNotReached,
  clsparseSolverError
}
 Building for OpenCL version is a compile time decision. More...
 

Functions

CLSPARSE_EXPORT clsparseStatus clsparseInitScalar (clsparseScalar *scalar)
 Initialize a scalar structure to be used in the clsparse library. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseInitVector (cldenseVector *vec)
 Initialize a dense vector structure to be used in the clsparse library. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseInitCooMatrix (clsparseCooMatrix *cooMatx)
 Initialize a sparse matrix COO structure to be used in the clsparse library. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseInitCsrMatrix (clsparseCsrMatrix *csrMatx)
 Initialize a sparse matrix CSR structure to be used in the clsparse library. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseInitMatrix (cldenseMatrix *denseMatx)
 Initialize a dense matrix structure to be used in the clsparse library. More...
 
CLSPARSE_EXPORT clsparseCreateResult clsparseCreateControl (cl_command_queue queue)
 Setup the clsparse control object from external OpenCL queue. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseEnableAsync (clsparseControl control, cl_bool async)
 Enable/Disable asynchronous behavior for clSPARSE. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseEnableExtendedPrecision (clsparseControl control, cl_bool extPrecision)
 Enable/Disable the use of compensated summation. More...
 
CLSPARSE_EXPORT clsparseEventResult clsparseGetEvent (clsparseControl control)
 Return an event from the last kernel execution. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseReleaseControl (clsparseControl control)
 Sets internal control fields to 0 or Null and frees allocated structures. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseHeaderfromFile (clsparseIdx_t *nnz, clsparseIdx_t *row, clsparseIdx_t *col, const char *filePath)
 Read the sparse matrix header from file. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseSCooMatrixfromFile (clsparseCooMatrix *cooMatx, const char *filePath, clsparseControl control, cl_bool read_explicit_zeroes)
 Read sparse matrix data from file in single precision COO format. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDCooMatrixfromFile (clsparseCooMatrix *cooMatx, const char *filePath, clsparseControl control, cl_bool read_explicit_zeroes)
 Read sparse matrix data from file in double precision COO format. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseSCsrMatrixfromFile (clsparseCsrMatrix *csrMatx, const char *filePath, clsparseControl control, cl_bool read_explicit_zeroes)
 Read sparse matrix data from file in single precision CSR format. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDCsrMatrixfromFile (clsparseCsrMatrix *csrMatx, const char *filePath, clsparseControl control, cl_bool read_explicit_zeroes)
 Read sparse matrix data from file in double precision CSR format. More...
 
CLSPARSE_EXPORT clsparseMetaSizeResult clsparseCsrMetaSize (clsparseCsrMatrix *csrMatx, clsparseControl control)
 Calculate the amount of device memory required to hold meta-data for csr-adaptive SpM-dV algorithm. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseCsrMetaCreate (clsparseCsrMatrix *csrMatx, clsparseControl control)
 Allocate memory and calculate the meta-data for csr-adaptive SpM-dV algorithm. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseCsrMetaDelete (clsparseCsrMatrix *csrMatx)
 Delete meta data associated with a CSR encoded matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseScsrmm (const clsparseScalar *alpha, const clsparseCsrMatrix *sparseMatA, const cldenseMatrix *denseMatB, const clsparseScalar *beta, cldenseMatrix *denseMatC, const clsparseControl control)
 Single precision CSR sparse matrix times dense matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDcsrmm (const clsparseScalar *alpha, const clsparseCsrMatrix *sparseMatA, const cldenseMatrix *denseMatB, const clsparseScalar *beta, cldenseMatrix *denseMatC, const clsparseControl control)
 Double precision CSR sparse matrix times dense matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseScsrSpGemm (const clsparseCsrMatrix *sparseMatA, const clsparseCsrMatrix *sparseMatB, clsparseCsrMatrix *sparseMatC, const clsparseControl control)
 Single Precision CSR Sparse Matrix times Sparse Matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseScsr2coo (const clsparseCsrMatrix *csr, clsparseCooMatrix *coo, const clsparseControl control)
 Convert a single precision CSR encoded sparse matrix into a COO encoded sparse matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDcsr2coo (const clsparseCsrMatrix *csr, clsparseCooMatrix *coo, const clsparseControl control)
 Convert a double precision CSR encoded sparse matrix into a COO encoded sparse matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseScoo2csr (const clsparseCooMatrix *coo, clsparseCsrMatrix *csr, const clsparseControl control)
 Convert a single precision COO encoded sparse matrix into a CSR encoded sparse matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDcoo2csr (const clsparseCooMatrix *coo, clsparseCsrMatrix *csr, const clsparseControl control)
 Convert a double precision COO encoded sparse matrix into a CSR encoded sparse matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseScsr2dense (const clsparseCsrMatrix *csr, cldenseMatrix *A, const clsparseControl control)
 Convert a single precision CSR encoded sparse matrix into a dense matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDcsr2dense (const clsparseCsrMatrix *csr, cldenseMatrix *A, clsparseControl control)
 Convert a double precision CSR encoded sparse matrix into a dense matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseSdense2csr (const cldenseMatrix *A, clsparseCsrMatrix *csr, const clsparseControl control)
 Convert a single precision dense matrix into a CSR encoded sparse matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDdense2csr (const cldenseMatrix *A, clsparseCsrMatrix *csr, const clsparseControl control)
 Convert a double precision dense matrix into a CSR encoded sparse matrix. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseSetup (void)
 Initialize the clsparse library. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseTeardown (void)
 Finalize the usage of the clsparse library Frees all state allocated by the clsparse runtime and other internal data. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseGetVersion (cl_uint *major, cl_uint *minor, cl_uint *patch, cl_uint *tweak)
 Query for the runtime clsparse library version info. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSscale (cldenseVector *r, const clsparseScalar *alpha, const cldenseVector *y, const clsparseControl control)
 Single precision scale dense vector by a scalar. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDscale (cldenseVector *r, const clsparseScalar *alpha, const cldenseVector *y, const clsparseControl control)
 Double precision scale dense vector by a scalar. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSaxpy (cldenseVector *r, const clsparseScalar *alpha, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Single precision scale dense vector and add dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDaxpy (cldenseVector *r, const clsparseScalar *alpha, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Double precision scale dense vector and add dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSaxpby (cldenseVector *r, const clsparseScalar *alpha, const cldenseVector *x, const clsparseScalar *beta, const cldenseVector *y, const clsparseControl control)
 Single precision scale dense vector and add scaled dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDaxpby (cldenseVector *r, const clsparseScalar *alpha, const cldenseVector *x, const clsparseScalar *beta, const cldenseVector *y, const clsparseControl control)
 Double precision scale dense vector and add scaled dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseIreduce (clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
 Reduce integer elements of a dense vector into a scalar value. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSreduce (clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
 Reduce single precision elements of a dense vector into a scalar value. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDreduce (clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
 Reduce double precision elements of a dense vector into a scalar value. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSnrm1 (clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
 Calculate the single precision L1 norm of a dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDnrm1 (clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
 Calculate the double precision L1 norm of a dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSnrm2 (clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
 Calculate the single precision L2 norm of a dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDnrm2 (clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
 Calculate the double precision L2 norm of a dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSdot (clsparseScalar *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Calculates the single precision dot-product of a dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDdot (clsparseScalar *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Calculates the double precision dot-product of a dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSadd (cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Element-wise single precision addition of two dense vectors. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDadd (cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Element-wise double precision addition of two dense vectors. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSsub (cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Element-wise single precision subtraction of two dense vectors. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDsub (cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Element-wise double precision subtraction of two dense vectors. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSmul (cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Element-wise single precision multiplication of two dense vectors. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDmul (cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Element-wise double precision multiplication of two dense vectors. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseSdiv (cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Element-wise single precision division of two dense vectors. More...
 
CLSPARSE_EXPORT clsparseStatus cldenseDdiv (cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
 Element-wise double precision division of two dense vectors. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseScsrmv (const clsparseScalar *alpha, const clsparseCsrMatrix *matx, const cldenseVector *x, const clsparseScalar *beta, cldenseVector *y, const clsparseControl control)
 Single precision CSR sparse matrix times dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDcsrmv (const clsparseScalar *alpha, const clsparseCsrMatrix *matx, const cldenseVector *x, const clsparseScalar *beta, cldenseVector *y, const clsparseControl control)
 Double precision CSR sparse matrix times dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseScoomv (const clsparseScalar *alpha, const clsparseCooMatrix *matx, const cldenseVector *x, const clsparseScalar *beta, cldenseVector *y, const clsparseControl control)
 Single precision COO sparse matrix times dense vector. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDcoomv (const clsparseScalar *alpha, const clsparseCooMatrix *matx, const cldenseVector *x, const clsparseScalar *beta, cldenseVector *y, const clsparseControl control)
 Double precision COO sparse matrix times dense vector. More...
 
enum  PRINT_MODE {
  QUIET = 0,
  NORMAL,
  VERBOSE
}
 Enumeration to control the verbosity of the sparse iterative solver routines. VERBOSE will print helpful diagnostic messages to console.
 
enum  PRECONDITIONER {
  NOPRECOND = 0,
  DIAGONAL
}
 Enumeration to select the preconditioning algorithm used to precondition the sparse data before the iterative solver execution phase.
 
typedef struct _solverControl * clSParseSolverControl
 clSParseSolverControl keeps state relevant for OpenCL operations like kernel execution, memory allocation and synchronization behavior, specifically for sparse iterative solvers
 
CLSPARSE_EXPORT clsparseCreateSolverResult clsparseCreateSolverControl (PRECONDITIONER precond, cl_int maxIters, cl_double relTol, cl_double absTol)
 Create a clSParseSolverControl object to control clsparse iterative solver operations. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseReleaseSolverControl (clSParseSolverControl solverControl)
 Release a clSParseSolverControl object created with clsparseCreateSolverControl. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseSetSolverParams (clSParseSolverControl solverControl, PRECONDITIONER precond, cl_int maxIters, cl_double relTol, cl_double absTol)
 Set clSParseSolverControl state. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseSolverPrintMode (clSParseSolverControl solverControl, PRINT_MODE mode)
 Set the verbosity level of the clSParseSolverControl object. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseScsrcg (cldenseVector *x, const clsparseCsrMatrix *A, const cldenseVector *b, clSParseSolverControl solverControl, clsparseControl control)
 Execute a single precision Conjugate Gradients solver. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDcsrcg (cldenseVector *x, const clsparseCsrMatrix *A, const cldenseVector *b, clSParseSolverControl solverControl, clsparseControl control)
 Execute a double precision Conjugate Gradients solver. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseScsrbicgStab (cldenseVector *x, const clsparseCsrMatrix *A, const cldenseVector *b, clSParseSolverControl solverControl, clsparseControl control)
 Execute a single precision Bi-Conjugate Gradients Stabilized solver. More...
 
CLSPARSE_EXPORT clsparseStatus clsparseDcsrbicgStab (cldenseVector *x, const clsparseCsrMatrix *A, const cldenseVector *b, clSParseSolverControl solverControl, clsparseControl control)
 Execute a double precision Bi-Conjugate Gradients Stabilized solver. More...
 

Detailed Description

clSPARSE.h defines 'C' compatible callable functions and types that call into the library

Enumeration Type Documentation

Building for OpenCL version is a compile time decision.

Possible error code values that can be returned from clSPARSE API's

Enumerator
clsparseNotImplemented 

Functionality is not implemented

clsparseNotInitialized 

clsparse library is not initialized yet

clsparseStructInvalid 

clsparse library is not initialized yet

clsparseInvalidSize 

Invalid size of object >

clsparseInvalidMemObj 

Checked object is no a valid cl_mem object

clsparseInsufficientMemory 

The memory object for vector is too small

clsparseInvalidControlObject 

clsparseControl object is not valid

clsparseInvalidFile 

Error reading the sparse matrix file

clsparseInvalidFileFormat 

Only specific documented sparse matrix files supported

clsparseInvalidKernelExecution 

Problem with kernel execution

clsparseInvalidType 

Functionality is not implemented