CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Is there any library for computing the inverse of a sparse matrix using parallelism?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By sbaffini
  • 1 Post By praveen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 22, 2018, 03:21
Default Is there any library for computing the inverse of a sparse matrix using parallelism?
  #1
Senior Member
 
Hector Redal
Join Date: Aug 2010
Location: Madrid, Spain
Posts: 243
Rep Power: 17
HectorRedal is on a distinguished road
Hi,


I would like to know if there exists a mathematical library that can be used for computing the inverse of a matrix (or the solution to a A . x = b linear system) leveraging in paralelism.


Currently I am using Eigen library, but the obtained paralelism is not very high.


Thanks in advance for your support.


Best regards,
HectorRedal is offline   Reply With Quote

Old   November 22, 2018, 05:19
Default
  #2
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,191
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Computing the inverse is quite different from computing the solution to the system, for a number of reasons. In practice, the inverse is almost never looked for, especially for large parallel systems.

Try giving a look at PETSc and Hypre. PETSc is basically targeted toward giving you the solution but, maybe, among the different third party libraries it can link to, you may find also something for the inverse.
FMDenaro likes this.
sbaffini is offline   Reply With Quote

Old   November 22, 2018, 09:30
Default
  #3
Super Moderator
 
Praveen. C
Join Date: Mar 2009
Location: Bangalore
Posts: 343
Blog Entries: 6
Rep Power: 18
praveen is on a distinguished road
As sbaffini wrote, do you really need the inverse matrix ?

Anyway,

MUMPS is a direct solver that works in parallel. It can solve Ax=b but I dont know if it can compute the inverse. You can do this yourself as follows.

First compute the LU decomposition using MUMPS. Then solve a sequence of problems with varying right hand side

A x_i = e_i, for i=1,2,...,n

where e_i has zeros except it has 1 at i'th location. Then the matrix

X = [x_1, x_2, ..., x_n]

is the inverse of A. Solving these problems is cheap (O(n^2) in general) as compare to computing the LU decomposition which costs O(n^3).

There is also superlu_dist. Both of these can be used via PETSc I think. If you already have your matrices setup in PETSc, then it is easy.
FMDenaro likes this.
praveen is offline   Reply With Quote

Old   November 22, 2018, 19:09
Default
  #4
Senior Member
 
Hector Redal
Join Date: Aug 2010
Location: Madrid, Spain
Posts: 243
Rep Power: 17
HectorRedal is on a distinguished road
Hi,


I don't really need the computation of the inverse matrix.
Indeed, in my current implementation, I am solving the linear system A . x = b without computing the inverse of the sparse matrix. I have implemented the BiGSTAB method for sparse matrices.


I was just looking for a more efficient manner, since I have spotted the bottleneck of the computation in this part of the software.



Thanks for the references, I will take a look at them.


Best regards,
HectorRedal is offline   Reply With Quote

Old   November 23, 2018, 01:44
Default
  #5
Super Moderator
 
Praveen. C
Join Date: Mar 2009
Location: Bangalore
Posts: 343
Blog Entries: 6
Rep Power: 18
praveen is on a distinguished road
If your goal is to solve large problems, then I would recommend learning to use petsc. PETSc has its own solvers and it can also call many other solvers. So advantage is if you build your matrix/rhs in petsc, you can experiment with many solvers easily, and you dont have to learn to use all of them, since each one will have its own interface/data structures.
praveen is offline   Reply With Quote

Old   November 23, 2018, 04:22
Default
  #6
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,865
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by HectorRedal View Post
Hi,


I don't really need the computation of the inverse matrix.
Indeed, in my current implementation, I am solving the linear system A . x = b without computing the inverse of the sparse matrix. I have implemented the BiGSTAB method for sparse matrices.


I was just looking for a more efficient manner, since I have spotted the bottleneck of the computation in this part of the software.



Thanks for the references, I will take a look at them.


Best regards,



An answer depends also on the shape of your matrix, sparse or not. If it is a matrix obtained by the discretization of elliptic equations on structured grids, you can find surprising that a black/white-marked SOR method will be the most efficient in terms of computational time and memory cost.
FMDenaro is offline   Reply With Quote

Old   November 23, 2018, 05:06
Default
  #7
Senior Member
 
Hector Redal
Join Date: Aug 2010
Location: Madrid, Spain
Posts: 243
Rep Power: 17
HectorRedal is on a distinguished road
Quote:
Originally Posted by praveen View Post
If your goal is to solve large problems, then I would recommend learning to use petsc. PETSc has its own solvers and it can also call many other solvers. So advantage is if you build your matrix/rhs in petsc, you can experiment with many solvers easily, and you dont have to learn to use all of them, since each one will have its own interface/data structures.

I will give it a try to petsc.

Thanks.
HectorRedal is offline   Reply With Quote

Old   November 23, 2018, 05:07
Default
  #8
Senior Member
 
Hector Redal
Join Date: Aug 2010
Location: Madrid, Spain
Posts: 243
Rep Power: 17
HectorRedal is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
An answer depends also on the shape of your matrix, sparse or not. If it is a matrix obtained by the discretization of elliptic equations on structured grids, you can find surprising that a black/white-marked SOR method will be the most efficient in terms of computational time and memory cost.

The matrix is obtained from unstructured grids (no structured grid). That's the reason why I am using sparse matrices.
Thanks.
HectorRedal is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
decomposePar is missing a library whk1992 OpenFOAM Pre-Processing 8 March 7, 2015 08:53
How can I find the inverse of a sparse matrix mechy OpenFOAM Programming & Development 2 January 19, 2014 22:29
Is there any c++ library that can be used for matrix calculation? HectorRedal Main CFD Forum 12 July 20, 2011 13:48
C++ solver for Large sparse matrix! sina_mech Main CFD Forum 7 November 20, 2009 14:52
OpenFOAM version 1.6 details lakeat OpenFOAM Running, Solving & CFD 42 August 26, 2009 22:47


All times are GMT -4. The time now is 21:35.