Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matrix inversion in OpenCL

Tags:

opencl

I am trying to accelerate some computations using OpenCL and part of the algorithm consists of inverting a matrix. Is there any open-source library or freely available code to compute lu factorization (lapack dgetrf and dgetri) of matrix or general inversion written in OpenCL or CUDA? The matrix is real and square but doesn't have any other special properties besides that. So far, I've managed to find only basic blas matrix-vector operations implementations on gpu.

The matrix is rather small, only about 60-100 rows and cols, so it could be computed faster on cpu, but it's used kinda in the middle of the algorithm, so I would have to transfer it to host, calculate the inverse, and then transfer the result back on the device where it's then used in much larger computations.

like image 855
buchtak Avatar asked May 31 '10 12:05

buchtak


2 Answers

Look at ViennaCL: http://viennacl.sourceforge.net/

like image 66
Hal Finkel Avatar answered Dec 12 '22 15:12

Hal Finkel


I don't have an implementation in Open CL, but both "Numerical Recipes" and Gil Strang's "Into to Applied Math" have wonderful explanations that would be easy to code. "NR" has C code that you could adapt.

calculate the inverse

This is incorrect. You aren't calculating an inverse with LU decomposition, you're decomposing the matrix. If you wanted the inverse, you'd have to do forward back substitution with a series of unit vectors. It's a small but important difference.

like image 20
duffymo Avatar answered Dec 12 '22 15:12

duffymo