# Solving an equation system with CUBLAS

I’m looking for a function that solves an equation system on matrix form Ax = b, x = inv(A) * b. The functions cublasStpsv() and cublasStrsv() both assume that the A-matrix is lower or upper triangular. Why isn’t a “normal” equation system solver implemented?

Usually, people first do an LU decomposition of A, such that A=LU, where L is lower triangular matrix and U is an upper triangular matrix.
Then you solve two equation:
Ly=b
Ux=y

Solving these two equations are much easier than one “normal” equation.

Yeah sure, but is LU-decomposition supported in CUBLAS?

I don’t know for sure, but the new version of CUBLAS is supposedly going to be released in the not-too-distant future. Vasily Volkov (vvolkov) did some research on matrix factorizations (LU/QR/Cholesky) that had fantastic results, so there were also rumors that his code might be added to the next release of CUBLAS. Perhaps one of the nVidia employees could fill in the details.

No.
LU decomposition is not supported in CUBLAS.
Some people have written their own version of QR decomposition library.
It should also be available in the coming CULAPACK.
http://www.hpca.uji.es/?q=node/10

Sorry for maybe a naive question, but how do i use cublasStrsv() ? I have a cuda function that returns a lower triangular matrix (but, its a full matrix, size nxn). when I pass it to cublasStrsv, like:

choldc(x);

``````maingputime=clock()-maingputime;

_b[0]=55.; _b[1] = -19.; _b[2] = 114.;
``````

for(int i0 = 0; i0 < _dim1; i0++)

``````{

for (int i1 = 0; i1 < _dim1; i1++)

_a[i0*_dim1 + i1] = x[i0][i1] ;

}

cublasStrsv ('u', 't', 'n', _dim1, _a, _dim1, _b, 1);

int status = cublasGetError();

cublasStrsv ('u', 'n', 'n', _dim1, _a, _dim1, _b, 1);
``````

Nothing seems to happen to my _b…

Any help will be appreciated !

TIA,

Arjun

PS: I even tried using cublas functions for copying to memory etc, but it just doesnt seem to work…

Sorry for maybe a naive question, but how do i use cublasStrsv() ? I have a cuda function that returns a lower triangular matrix (but, its a full matrix, size nxn). when I pass it to cublasStrsv, like:

choldc(x);

maingputime=clock()-maingputime;

_b[0]=55.; _b[1] = -19.; _b[2] = 114.;

for(int i0 = 0; i0 < _dim1; i0++)

{

for (int i1 = 0; i1 < _dim1; i1++)

_a[i0*_dim1 + i1] = x[i0][i1] ;

}

cublasStrsv (‘u’, ‘t’, ‘n’, _dim1, _a, _dim1, _b, 1);

int status = cublasGetError();

cublasStrsv (‘u’, ‘n’, ‘n’, _dim1, _a, _dim1, _b, 1);

Nothing seems to happen to my _b…

Any help will be appreciated !

TIA,

Arjun

PS: I even tried using cublas functions for copying to memory etc, but it just doesnt seem to work…