34 #include "clsparse_export.h" 42 #if( BUILD_CLVERSION < 200 ) 45 #error clSPARSE does not yet implement OpenCL 2.0 interfaces 51 typedef enum clsparseStatus_
55 clsparseSuccess = CL_SUCCESS,
56 clsparseInvalidValue = CL_INVALID_VALUE,
57 clsparseInvalidCommandQueue = CL_INVALID_COMMAND_QUEUE,
58 clsparseInvalidContext = CL_INVALID_CONTEXT,
59 clsparseInvalidMemObject = CL_INVALID_MEM_OBJECT,
60 clsparseInvalidDevice = CL_INVALID_DEVICE,
61 clsparseInvalidEventWaitList = CL_INVALID_EVENT_WAIT_LIST,
62 clsparseInvalidEvent = CL_INVALID_EVENT,
63 clsparseOutOfResources = CL_OUT_OF_RESOURCES,
64 clsparseOutOfHostMemory = CL_OUT_OF_HOST_MEMORY,
65 clsparseInvalidOperation = CL_INVALID_OPERATION,
66 clsparseCompilerNotAvailable = CL_COMPILER_NOT_AVAILABLE,
67 clsparseBuildProgramFailure = CL_BUILD_PROGRAM_FAILURE,
68 clsparseInvalidKernelArgs = CL_INVALID_KERNEL_ARGS,
88 clsparseInvalidSolverControlObject = -2048,
89 clsparseInvalidSystemSize,
90 clsparseIterationsExceeded,
91 clsparseToleranceNotReached,
114 CLSPARSE_EXPORT clsparseStatus
125 CLSPARSE_EXPORT clsparseStatus
140 CLSPARSE_EXPORT clsparseStatus
161 CLSPARSE_EXPORT clsparseStatus
174 CLSPARSE_EXPORT clsparseStatus
187 CLSPARSE_EXPORT clsparseStatus
200 CLSPARSE_EXPORT clsparseStatus
213 CLSPARSE_EXPORT clsparseStatus
234 typedef struct _clsparseCreateResult
262 CLSPARSE_EXPORT clsparseStatus
276 CLSPARSE_EXPORT clsparseStatus
282 typedef struct _clsparseEventResult
309 CLSPARSE_EXPORT clsparseStatus
327 typedef enum _print_mode
339 typedef enum _precond
356 typedef struct _clsparseCreateSolverResult
377 cl_double relTol, cl_double absTol );
388 CLSPARSE_EXPORT clsparseStatus
404 CLSPARSE_EXPORT clsparseStatus
406 PRECONDITIONER precond,
407 cl_int maxIters, cl_double relTol, cl_double absTol );
419 CLSPARSE_EXPORT clsparseStatus
435 CLSPARSE_EXPORT clsparseStatus
437 clSParseSolverControl solverControl, clsparseControl control );
452 CLSPARSE_EXPORT clsparseStatus
454 clSParseSolverControl solverControl, clsparseControl control );
469 CLSPARSE_EXPORT clsparseStatus
471 clSParseSolverControl solverControl, clsparseControl control );
486 CLSPARSE_EXPORT clsparseStatus
488 clSParseSolverControl solverControl, clsparseControl control );
514 CLSPARSE_EXPORT clsparseStatus
539 CLSPARSE_EXPORT clsparseStatus
565 CLSPARSE_EXPORT clsparseStatus
590 CLSPARSE_EXPORT clsparseStatus
616 CLSPARSE_EXPORT clsparseStatus
623 typedef struct _clsparseMetaSizeResult
654 CLSPARSE_EXPORT clsparseStatus
664 CLSPARSE_EXPORT clsparseStatus
700 CLSPARSE_EXPORT clsparseStatus
704 const clsparseControl control );
716 CLSPARSE_EXPORT clsparseStatus
720 const clsparseControl control );
733 CLSPARSE_EXPORT clsparseStatus
737 const clsparseControl control );
750 CLSPARSE_EXPORT clsparseStatus
754 const clsparseControl control );
768 CLSPARSE_EXPORT clsparseStatus
773 const clsparseControl control );
787 CLSPARSE_EXPORT clsparseStatus
792 const clsparseControl control );
803 CLSPARSE_EXPORT clsparseStatus
806 const clsparseControl control );
817 CLSPARSE_EXPORT clsparseStatus
820 const clsparseControl control );
831 CLSPARSE_EXPORT clsparseStatus
834 const clsparseControl control );
844 CLSPARSE_EXPORT clsparseStatus
847 const clsparseControl control );
857 CLSPARSE_EXPORT clsparseStatus
860 const clsparseControl control );
870 CLSPARSE_EXPORT clsparseStatus
873 const clsparseControl control );
883 CLSPARSE_EXPORT clsparseStatus
886 const clsparseControl control );
897 CLSPARSE_EXPORT clsparseStatus
901 const clsparseControl control );
912 CLSPARSE_EXPORT clsparseStatus
916 const clsparseControl control );
929 CLSPARSE_EXPORT clsparseStatus
933 const clsparseControl control );
944 CLSPARSE_EXPORT clsparseStatus
948 const clsparseControl control );
959 CLSPARSE_EXPORT clsparseStatus
963 const clsparseControl control );
974 CLSPARSE_EXPORT clsparseStatus
978 const clsparseControl control );
989 CLSPARSE_EXPORT clsparseStatus
993 const clsparseControl control );
1004 CLSPARSE_EXPORT clsparseStatus
1008 const clsparseControl control );
1019 CLSPARSE_EXPORT clsparseStatus
1023 const clsparseControl control );
1034 CLSPARSE_EXPORT clsparseStatus
1038 const clsparseControl control );
1068 CLSPARSE_EXPORT clsparseStatus
1074 const clsparseControl control );
1091 CLSPARSE_EXPORT clsparseStatus
1097 const clsparseControl control );
1112 CLSPARSE_EXPORT clsparseStatus
1118 const clsparseControl control );
1132 CLSPARSE_EXPORT clsparseStatus
1138 const clsparseControl control );
1165 CLSPARSE_EXPORT clsparseStatus
1171 const clsparseControl control );
1187 CLSPARSE_EXPORT clsparseStatus
1193 const clsparseControl control );
1205 CLSPARSE_EXPORT clsparseStatus
1209 const clsparseControl control );
1231 CLSPARSE_EXPORT clsparseStatus
1234 const clsparseControl control );
1245 CLSPARSE_EXPORT clsparseStatus
1248 const clsparseControl control );
1259 CLSPARSE_EXPORT clsparseStatus
1262 const clsparseControl control );
1273 CLSPARSE_EXPORT clsparseStatus
1276 const clsparseControl control );
1287 CLSPARSE_EXPORT clsparseStatus
1290 const clsparseControl control );
1301 CLSPARSE_EXPORT clsparseStatus
1304 clsparseControl control );
1315 CLSPARSE_EXPORT clsparseStatus
1318 const clsparseControl control );
1329 CLSPARSE_EXPORT clsparseStatus
1331 const clsparseControl control );
1338 #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:284
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:339
PRINT_MODE
Enumeration to control the verbosity of the sparse iterative solver routines. VERBOSE will print help...
Definition: clSPARSE.h:327
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:356
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:236
CLSPARSE_EXPORT clsparseStatus clsparseInitScalar(clsparseScalar *scalar)
Initialize a scalar structure to be used in the clsparse library.
Definition: clSPARSE.h:73
cl_event event
Definition: clSPARSE.h:285
CLSPARSE_EXPORT clsparseStatus clsparseCsrMetaDelete(clsparseCsrMatrix *csrMatx)
Delete meta data associated with a CSR encoded matrix.
clsparseStatus status
Definition: clSPARSE.h:358
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:359
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:75
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:80
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:82
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:83
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:81
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:351
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:79
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:234
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:77
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:282
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:78
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:74
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:76
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:51
Structure to encapsulate scalar data to clSPARSE API.
Definition: clSPARSE-1x.h:31
clsparseControl control
Definition: clSPARSE.h:237
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:229