CSol
|
OpenCL linear algebra class. More...
#include <csol_la.h>
Public Member Functions | |
LinearAlgebra (int, cl::Context &, cl::CommandQueue &, std::vector< cl::Device > &, int) | |
LinearAlgebra constructor. More... | |
LinearAlgebra (const LinearAlgebra &) | |
~LinearAlgebra () | |
void | copyIntBuffer (const cl::Buffer &, cl::Buffer &, int) |
LinearAlgebra integer buffer copy. More... | |
void | copyRealBuffer (const cl::Buffer &, cl::Buffer &, int) |
LinearAlgebra floating-point buffer copy. More... | |
cl::Buffer | createIntBuffer (int) |
LinearAlgebra integer buffer creation. More... | |
cl::Buffer | createRealBuffer (int) |
LinearAlgebra floating-point buffer creation. More... | |
REAL | Dot (const Vector &, const Vector &) |
LinearAlgebra vector dot product. More... | |
int | getWorkGroupSize () |
void | minusEqualsVector (cl::Buffer &, const cl::Buffer &, int, int) |
LinearAlgebra -= operation. More... | |
LinearAlgebra & | operator= (const LinearAlgebra &) |
void | plusEqualsVector (cl::Buffer &, const cl::Buffer &, int, int) |
LinearAlgebra += operation. More... | |
void | readIntBuffer (int *, const cl::Buffer &, int) |
LinearAlgebra integer read. More... | |
void | readRealBuffer (REAL *, const cl::Buffer &, int) |
LinearAlgebra floating-point read. More... | |
void | reserveSparseMatrix (int, int, int, int, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &) |
LinearAlgebra sparse matrix reservation implementation. More... | |
void | setIntBuffer (cl::Buffer &, int, int) |
LinearAlgebra integer vector set operation. More... | |
void | setRealBuffer (cl::Buffer &, REAL, int) |
LinearAlgebra floating-point vector set operation. More... | |
Vector | Solve (const SparseMatrix &, const Vector &, const Vector &) |
LinearAlgebra sparse matrix solve. More... | |
void | sparseMatrixProduct (const cl::Buffer &, cl::Buffer &, const cl::Buffer &, const cl::Buffer &, const cl::Buffer &, const cl::Buffer &, int, int) |
LinearAlgebra sparse matrix product implementation. More... | |
void | timesEqualsScalar (cl::Buffer &, REAL, int, int) |
LinearAlgebra *= operation. More... | |
void | timesEqualsVector (cl::Buffer &, const cl::Buffer &, int, int) |
LinearAlgebra *= operation. More... | |
void | writeIntBuffer (int *, cl::Buffer &, int) |
LinearAlgebra integer write. More... | |
void | writeRealBuffer (REAL *, cl::Buffer &, int) |
LinearAlgebra floating-point write. More... | |
Base class for OpenCL linear algebra operations, including vector and matrix types. Implements a number of vector operations as well as a preconditioned conjugate gradient solver.
LinearAlgebra | ( | int | workGroupSize_, |
cl::Context & | context_, | ||
cl::CommandQueue & | queue_, | ||
std::vector< cl::Device > & | devices_, | ||
int | deviceID | ||
) |
workGroupSize_ | OpenCL work-group size to use. |
context_ | OpenCL context handle. |
queue_ | OpenCL queue handle. |
devices_ | OpenCL device list. |
deviceID | OpenCL device ID to use. |
|
inline |
LinearAlgebra | ( | const LinearAlgebra & | ) |
void copyIntBuffer | ( | const cl::Buffer & | source, |
cl::Buffer & | dest, | ||
int | n | ||
) |
source | source buffer. |
dest | destination buffer. |
n | number of items to copy. |
void copyRealBuffer | ( | const cl::Buffer & | source, |
cl::Buffer & | dest, | ||
int | n | ||
) |
source | source buffer. |
dest | destination buffer. |
n | number of items to copy. |
cl::Buffer createIntBuffer | ( | int | size | ) |
size | size of buffer. |
cl::Buffer createRealBuffer | ( | int | size | ) |
size | size of buffer. |
a | first vector. |
b | second vector. |
|
inline |
void minusEqualsVector | ( | cl::Buffer & | base, |
const cl::Buffer & | op, | ||
int | padn, | ||
int | n | ||
) |
base | buffer to set. |
op | buffer to subtract. |
padn | number of items padded to work-group size. |
n | number of items to set. |
LinearAlgebra& operator= | ( | const LinearAlgebra & | ) |
void plusEqualsVector | ( | cl::Buffer & | base, |
const cl::Buffer & | op, | ||
int | padn, | ||
int | n | ||
) |
base | buffer to set. |
op | buffer to add. |
padn | number of items padded to work-group size. |
n | number of items to set. |
void readIntBuffer | ( | int * | dest, |
const cl::Buffer & | source, | ||
int | n | ||
) |
dest | memory pointer to copy to. |
source | source buffer. |
n | number of items to copy. |
void readRealBuffer | ( | REAL * | dest, |
const cl::Buffer & | source, | ||
int | n | ||
) |
dest | memory pointer to copy to. |
source | source buffer. |
n | number of items to copy. |
void reserveSparseMatrix | ( | int | i, |
int | j, | ||
int | index, | ||
int | nWritten, | ||
cl::Buffer & | row, | ||
cl::Buffer & | col, | ||
cl::Buffer & | idx, | ||
cl::Buffer & | rowstart, | ||
cl::Buffer & | rowlength | ||
) |
void setIntBuffer | ( | cl::Buffer & | base, |
int | op, | ||
int | padn | ||
) |
base | buffer to set. |
op | value to set buffer to. |
padn | number of items to set. |
void setRealBuffer | ( | cl::Buffer & | base, |
REAL | op, | ||
int | padn | ||
) |
base | buffer to set. |
op | value to set buffer to. |
padn | number of items to set. |
Vector Solve | ( | const SparseMatrix & | A, |
const Vector & | iM, | ||
const Vector & | b | ||
) |
Solves linear system of the form Ax = b using CGM with Jacobi preconditioner. The sparse matrix must be symmetric positive definite. The preconditioner iM must contain the inverse diagonal entries of A.
A | sparse matrix. |
iM | Jacobi preconditioning vector. |
b | forcing vector. |
void sparseMatrixProduct | ( | const cl::Buffer & | vec_in, |
cl::Buffer & | vec_out, | ||
const cl::Buffer & | v, | ||
const cl::Buffer & | col, | ||
const cl::Buffer & | rowstart, | ||
const cl::Buffer & | rowlength, | ||
int | rowdim, | ||
int | padrowdim | ||
) |
void timesEqualsScalar | ( | cl::Buffer & | base, |
REAL | op, | ||
int | padn, | ||
int | n | ||
) |
base | buffer to set. |
op | multiplication value. |
padn | number of items padded to work-group size. |
n | number of items to set. |
void timesEqualsVector | ( | cl::Buffer & | base, |
const cl::Buffer & | op, | ||
int | padn, | ||
int | n | ||
) |
base | buffer to set. |
op | buffer to multiply. |
padn | number of items padded to work-group size. |
n | number of items to set. |
void writeIntBuffer | ( | int * | source, |
cl::Buffer & | dest, | ||
int | n | ||
) |
source | memory pointer to copy from. |
dest | destination buffer. |
n | number of items to copy. |
void writeRealBuffer | ( | REAL * | source, |
cl::Buffer & | dest, | ||
int | n | ||
) |
source | memory pointer to copy from. |
dest | destination buffer. |
n | number of items to copy. |