# How can I optimize the solution of linear systems in my Finite Element Method code for solving nonlinear computational mechanics problems?

Currently, I use Eigen3 for linear algebra operations on sparse matrices and either UMFPACK or CHOLMOD from SuiteSparse to solve sparse linear systems. However, as my model grows larger and the need for iterative methods to solve nonlinear equations arises, I am facing a bottleneck in the code's performance, particularly in the solution of linear systems at each iteration.

I would like to improve computational efficiency and reduce execution time by implementing a parallel solver. However, I'm unsure if libraries like PETSc and Trilinos are suitable for use on laptops or if they are primarily designed for large clusters. I would appreciate recommendations for parallel solver libraries that are well-suited for solving sparse linear systems efficiently on a laptop, taking advantage of the available resources such as my i7-11390H processor and 16GB RAM, to achieve optimal performance.

• I can't give very good recommendations on particular software, but do know that software conceived for distributed memory parallelism (MPI) will still work (almost) as well as if simply multi-threaded on a single machine. I doubt any of these big names wouldn't be distributed + multi-thread anyways. You can (and most definitely should, that's why you have 4 or 8 cores) use parallel software on your laptop ! May 24, 2023 at 1:13
• At the very least, using the iterative linear solvers, nonlinear solvers, and preconditioners available in something like PETSc will provide some very efficient scalable algorithms compared to factorization-based methods. Just the algorithmic difference might lead to some significant advantages, even on a laptop May 24, 2023 at 2:55
• Neither PETSc not Trilinos use threads. Both use MPI, however. May 24, 2023 at 3:20
• And both are efficient with MPI, very much so on laptops too. The downside is that you have to re-work your code so that it uses MPI. That might be a lot of work, and is a good argument for making this the time to switch over to one of the existing large finite element libraries that already do all this (and much more). May 24, 2023 at 3:21
• @ProfessorP.CosmoKlunk Yes, they have somewhat fallen out of favor and are consequently not well supported in modern libraries. There are good alternatives, though! May 24, 2023 at 16:29