28 #include "clsparse_export.h"
36 #if( BUILD_CLVERSION < 200 )
39 #error clSPARSE does not yet implement OpenCL 2.0 interfaces
45 typedef enum clsparseStatus_
49 clsparseSuccess = CL_SUCCESS,
50 clsparseInvalidValue = CL_INVALID_VALUE,
51 clsparseInvalidCommandQueue = CL_INVALID_COMMAND_QUEUE,
52 clsparseInvalidContext = CL_INVALID_CONTEXT,
53 clsparseInvalidMemObject = CL_INVALID_MEM_OBJECT,
54 clsparseInvalidDevice = CL_INVALID_DEVICE,
55 clsparseInvalidEventWaitList = CL_INVALID_EVENT_WAIT_LIST,
56 clsparseInvalidEvent = CL_INVALID_EVENT,
57 clsparseOutOfResources = CL_OUT_OF_RESOURCES,
58 clsparseOutOfHostMemory = CL_OUT_OF_HOST_MEMORY,
59 clsparseInvalidOperation = CL_INVALID_OPERATION,
60 clsparseCompilerNotAvailable = CL_COMPILER_NOT_AVAILABLE,
61 clsparseBuildProgramFailure = CL_BUILD_PROGRAM_FAILURE,
62 clsparseInvalidKernelArgs = CL_INVALID_KERNEL_ARGS,
82 clsparseInvalidSolverControlObject = -2048,
83 clsparseInvalidSystemSize,
84 clsparseIterationsExceeded,
85 clsparseToleranceNotReached,
228 typedef struct _clsparseCreateResult
276 typedef struct _clsparseEventResult
321 typedef enum _print_mode
333 typedef enum _precond
350 typedef struct _clsparseCreateSolverResult
371 cl_double relTol, cl_double absTol );
401 cl_int maxIters, cl_double relTol, cl_double absTol );
431 clSParseSolverControl solverControl, clsparseControl control );
448 clSParseSolverControl solverControl, clsparseControl control );
465 clSParseSolverControl solverControl, clsparseControl control );
482 clSParseSolverControl solverControl, clsparseControl control );
617 typedef struct _clsparseMetaSizeResult
698 const clsparseControl control );
714 const clsparseControl control );
731 const clsparseControl control );
748 const clsparseControl control );
767 const clsparseControl control );
786 const clsparseControl control );
800 const clsparseControl control );
814 const clsparseControl control );
828 const clsparseControl control );
841 const clsparseControl control );
854 const clsparseControl control );
867 const clsparseControl control );
880 const clsparseControl control );
895 const clsparseControl control );
910 const clsparseControl control );
927 const clsparseControl control );
942 const clsparseControl control );
957 const clsparseControl control );
972 const clsparseControl control );
987 const clsparseControl control );
1002 const clsparseControl control );
1017 const clsparseControl control );
1032 const clsparseControl control );
1068 const clsparseControl control );
1091 const clsparseControl control );
1112 const clsparseControl control );
1132 const clsparseControl control );
1165 const clsparseControl control );
1187 const clsparseControl control );
1203 const clsparseControl control );
1228 const clsparseControl control );
1242 const clsparseControl control );
1256 const clsparseControl control );
1270 const clsparseControl control );
1284 const clsparseControl control );
1298 clsparseControl control );
1312 const clsparseControl control );
1325 const clsparseControl control );
1332 #endif // _CL_SPARSE_H_
CLSPARSE_EXPORT clsparseStatus cldenseDnrm2(clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
Calculate the double precision L2 norm of a dense vector.
clsparseStatus status
Definition: clSPARSE.h:278
CLSPARSE_EXPORT clsparseStatus cldenseSscale(cldenseVector *r, const clsparseScalar *alpha, const cldenseVector *y, const clsparseControl control)
Single precision scale dense vector by a scalar.
CLSPARSE_EXPORT clsparseStatus clsparseReleaseControl(clsparseControl control)
Sets internal control fields to 0 or Null and frees allocated structures.
PRECONDITIONER
Enumeration to select the preconditioning algorithm used to precondition the sparse data before the i...
Definition: clSPARSE.h:333
PRINT_MODE
Enumeration to control the verbosity of the sparse iterative solver routines. VERBOSE will print help...
Definition: clSPARSE.h:321
CLSPARSE_EXPORT clsparseStatus cldenseIreduce(clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
Reduce integer elements of a dense vector into a scalar value.
A structure returned by value from the clsparseCreateSolverControl function. This serves as result/st...
Definition: clSPARSE.h:350
CLSPARSE_EXPORT clsparseStatus cldenseSmul(cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
Element-wise single precision multiplication of two dense vectors.
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.
clSPARSE-1x.h defines public types specific to OpenCL 1.x API's. This file is kept as a strictly 'C' ...
CLSPARSE_EXPORT clsparseCreateResult clsparseCreateControl(cl_command_queue queue)
Setup the clsparse control object from external OpenCL queue.
clsparseStatus status
Definition: clSPARSE.h:230
CLSPARSE_EXPORT clsparseStatus clsparseInitScalar(clsparseScalar *scalar)
Initialize a scalar structure to be used in the clsparse library.
Definition: clSPARSE.h:67
cl_event event
Definition: clSPARSE.h:279
CLSPARSE_EXPORT clsparseStatus clsparseCsrMetaDelete(clsparseCsrMatrix *csrMatx)
Delete meta data associated with a CSR encoded matrix.
clsparseStatus status
Definition: clSPARSE.h:352
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.
CLSPARSE_EXPORT clsparseStatus cldenseDsub(cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
Element-wise double precision subtraction of two dense vectors.
CLSPARSE_EXPORT clsparseEventResult clsparseGetEvent(clsparseControl control)
Return an event from the last kernel execution.
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.
CLSPARSE_EXPORT clsparseStatus clsparseScsrcg(cldenseVector *x, const clsparseCsrMatrix *A, const cldenseVector *b, clSParseSolverControl solverControl, clsparseControl control)
Execute a single precision Conjugate Gradients solver.
clSParseSolverControl control
Definition: clSPARSE.h:353
CLSPARSE_EXPORT clsparseStatus clsparseScsrSpGemm(const clsparseCsrMatrix *sparseMatA, const clsparseCsrMatrix *sparseMatB, clsparseCsrMatrix *sparseMatC, const clsparseControl control)
Single Precision CSR Sparse Matrix times Sparse Matrix.
Definition: clSPARSE.h:69
CLSPARSE_EXPORT clsparseStatus cldenseSsub(cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
Element-wise single precision subtraction of two dense vectors.
Definition: clSPARSE.h:74
CLSPARSE_EXPORT clsparseStatus cldenseDnrm1(clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
Calculate the double precision L1 norm of a dense vector.
CLSPARSE_EXPORT clsparseStatus clsparseCsrMetaCreate(clsparseCsrMatrix *csrMatx, clsparseControl control)
Allocate memory and calculate the meta-data for csr-adaptive SpM-dV algorithm.
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.
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.
Definition: clSPARSE.h:76
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...
CLSPARSE_EXPORT clsparseStatus cldenseInitMatrix(cldenseMatrix *denseMatx)
Initialize a dense matrix structure to be used in the clsparse library.
Definition: clSPARSE.h:77
CLSPARSE_EXPORT clsparseStatus cldenseSnrm2(clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
Calculate the single precision L2 norm of a dense vector.
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.
Definition: clSPARSE.h:75
CLSPARSE_EXPORT clsparseStatus clsparseHeaderfromFile(clsparseIdx_t *nnz, clsparseIdx_t *row, clsparseIdx_t *col, const char *filePath)
Read the sparse matrix header from file.
Structure to encapsulate sparse matrix data encoded in CSR form to clSPARSE API.
Definition: clSPARSE-1x.h:60
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.
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.
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.
struct _solverControl * clSParseSolverControl
clSParseSolverControl keeps state relevant for OpenCL operations like kernel execution, memory allocation and synchronization behavior, specifically for sparse iterative solvers
Definition: clSPARSE.h:345
CLSPARSE_EXPORT clsparseStatus clsparseSetup(void)
Initialize the clsparse library.
CLSPARSE_EXPORT clsparseStatus cldenseDdiv(cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
Element-wise double precision division of two dense vectors.
CLSPARSE_EXPORT clsparseStatus clsparseScsr2dense(const clsparseCsrMatrix *csr, cldenseMatrix *A, const clsparseControl control)
Convert a single precision CSR encoded sparse matrix into a dense matrix.
CLSPARSE_EXPORT clsparseStatus clsparseTeardown(void)
Finalize the usage of the clsparse library Frees all state allocated by the clsparse runtime and othe...
clSPARSE-2x.h defines public types specific to OpenCL 2.x API's. This file is kept as a strictly 'C' ...
CLSPARSE_EXPORT clsparseStatus clsparseDcsrcg(cldenseVector *x, const clsparseCsrMatrix *A, const cldenseVector *b, clSParseSolverControl solverControl, clsparseControl control)
Execute a double precision Conjugate Gradients solver.
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.
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.
CLSPARSE_EXPORT clsparseStatus cldenseSreduce(clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
Reduce single precision elements of a dense vector into a scalar value.
CLSPARSE_EXPORT clsparseStatus clsparseDcsr2dense(const clsparseCsrMatrix *csr, cldenseMatrix *A, clsparseControl control)
Convert a double precision CSR encoded sparse matrix into a dense matrix.
CLSPARSE_EXPORT clsparseStatus clsparseGetVersion(cl_uint *major, cl_uint *minor, cl_uint *patch, cl_uint *tweak)
Query for the runtime clsparse library version info.
CLSPARSE_EXPORT clsparseStatus clsparseEnableAsync(clsparseControl control, cl_bool async)
Enable/Disable asynchronous behavior for clSPARSE.
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.
Definition: clSPARSE.h:73
Structure to encapsulate dense matrix data to clSPARSE API.
Definition: clSPARSE-1x.h:127
CLSPARSE_EXPORT clsparseStatus clsparseSetSolverParams(clSParseSolverControl solverControl, PRECONDITIONER precond, cl_int maxIters, cl_double relTol, cl_double absTol)
Set clSParseSolverControl state.
A structure returned by value from the clsparseCreateControl function. This serves as result/status p...
Definition: clSPARSE.h:228
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.
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.
CLSPARSE_EXPORT clsparseStatus cldenseDscale(cldenseVector *r, const clsparseScalar *alpha, const cldenseVector *y, const clsparseControl control)
Double precision scale dense vector by a scalar.
CLSPARSE_EXPORT clsparseStatus cldenseSdiv(cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
Element-wise single precision division of two dense vectors.
CLSPARSE_EXPORT clsparseStatus cldenseDadd(cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
Element-wise double precision addition of two dense vectors.
Definition: clSPARSE.h:71
CLSPARSE_EXPORT clsparseStatus cldenseSnrm1(clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
Calculate the single precision L1 norm of a dense vector.
CLSPARSE_EXPORT clsparseStatus clsparseEnableExtendedPrecision(clsparseControl control, cl_bool extPrecision)
Enable/Disable the use of compensated summation.
cl_uint clsparseIdx_t
An abstraction for the size of indices supported by the library. Clients should use this index type w...
Definition: clSPARSE-xx.h:49
CLSPARSE_EXPORT clsparseStatus clsparseInitVector(cldenseVector *vec)
Initialize a dense vector structure to be used in the clsparse library.
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.
Structure to encapsulate sparse matrix data encoded in COO form to clSPARSE API.
Definition: clSPARSE-1x.h:97
A structure returned by value from the clsparseGetEvent function. This serves as result/status pair f...
Definition: clSPARSE.h:276
CLSPARSE_EXPORT clsparseStatus clsparseInitCsrMatrix(clsparseCsrMatrix *csrMatx)
Initialize a sparse matrix CSR structure to be used in the clsparse library.
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.
Definition: clSPARSE.h:72
CLSPARSE_EXPORT clsparseStatus cldenseDmul(cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
Element-wise double precision multiplication of two dense vectors.
Definition: clSPARSE.h:68
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.
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.
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.
Definition: clSPARSE.h:70
CLSPARSE_EXPORT clsparseStatus clsparseSdense2csr(const cldenseMatrix *A, clsparseCsrMatrix *csr, const clsparseControl control)
Convert a single precision dense matrix into a CSR encoded sparse matrix.
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.
CLSPARSE_EXPORT clsparseStatus clsparseSolverPrintMode(clSParseSolverControl solverControl, PRINT_MODE mode)
Set the verbosity level of the clSParseSolverControl object.
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.
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.
CLSPARSE_EXPORT clsparseStatus cldenseDreduce(clsparseScalar *s, const cldenseVector *x, const clsparseControl control)
Reduce double precision elements of a dense vector into a scalar value.
CLSPARSE_EXPORT clsparseStatus clsparseInitCooMatrix(clsparseCooMatrix *cooMatx)
Initialize a sparse matrix COO structure to be used in the clsparse library.
CLSPARSE_EXPORT clsparseStatus clsparseReleaseSolverControl(clSParseSolverControl solverControl)
Release a clSParseSolverControl object created with clsparseCreateSolverControl.
CLSPARSE_EXPORT clsparseStatus cldenseSadd(cldenseVector *r, const cldenseVector *x, const cldenseVector *y, const clsparseControl control)
Element-wise single precision addition of two dense vectors.
Structure to encapsulate dense vector data to clSPARSE API.
Definition: clSPARSE-1x.h:43
clsparseStatus
Building for OpenCL version is a compile time decision.
Definition: clSPARSE.h:45
Structure to encapsulate scalar data to clSPARSE API.
Definition: clSPARSE-1x.h:31
clsparseControl control
Definition: clSPARSE.h:231
CLSPARSE_EXPORT clsparseStatus clsparseDdense2csr(const cldenseMatrix *A, clsparseCsrMatrix *csr, const clsparseControl control)
Convert a double precision dense matrix into a CSR encoded sparse matrix.
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.
struct _clsparseControl * clsparseControl
clsparseControl keeps OpenCL state like kernel execution, memory allocation and synchronization behav...
Definition: clSPARSE.h:223