 # Linear equations and sparse matrix CUBLAS, CUSPARSE, CULA

Hello, i am working in a project which now requires me to solve some linear equations in a recursive way (ricatti equation) because i would like to use linear cuadratic control in a system.

In particular, i am trying to solve this equations with my gpu:

u[k] = - K[k]*x[k]
K[k] = ((R + B’*S[k+1]*B)^(-1) )B’S[k+1]A
S[k] = (A-B
K[k])'S[k+1](A-B
K[k]) + Q + K[k]'RK[k]

For this system A, B, R, Q, S[k0] are sparse ones. Maybe i should use many libraries together or a library and a kernel done by myself.

I am with cuda 4.0 and i have been seeing CUBLAS, CUSPARSE and CULA (free edition)…
What would you reccommend me to use or to do with this problem to get the fastest result? Nothing seems to satisfy me…

Thanks for your help! My experience for such problem is that if you only have small or medium size matrices (i.e.,<500), GPU-accelerated linear algebra package would not be very helpful. Particularly, if you need frequently update your entries and communicate between CPU and GPU. MAGMA is the fourth option to these three. It is free for both single and double precisions.

If you want to solve the equation using matrix inversion, you many need to use CULA or MAGMA. I have not used CUSPARSE before, but based on your description, it may not be helpful since you may need to convert the matrix format back and forth between sparse solver and dense solver.

Yes, i have small matrices and also need matrix inversion, products, transpose, sums and iterations of these operations…

So, you recommend me MAGMA as a entire solution for my problem? Thanks for your reply!

I thought that curspace would not be helpful for the same things that you told me but i was not sure…