Skip to main content
Share Your Experience: Take the 2024 Developer Survey
12 votes
Accepted

PETSc-like library for Julia

Julia is built in such a way that you will never see a full PETSc-like library, and that's on purpose. PETSc is not a single thing: it is an HPC library with some utility functions, linear solvers, ...
Chris Rackauckas's user avatar
10 votes

Are there any "light-weight" FEM packages around?

I've been developing a lightweight finite element library in Python 2.7 harnessing the power of NumPy arrays and SciPy sparse matrices. The general idea is that given a mesh and a finite element, you ...
knl's user avatar
  • 2,104
6 votes
Accepted

Efficiency of parallel direct linear solver

Your problem is too small. You have to consider that to get good efficiency, each processor has to have enough work to offset the cost of communication. In other words, there is a threshold how many ...
Wolfgang Bangerth's user avatar
5 votes

Distributed (MPI) matrix matrix multiplication

You say that you want an MPI version. Then you need to study the literature, as the distributed memory variant of matrix-matrix product are not a simple parallellization of the sequential version. ...
Victor Eijkhout's user avatar
4 votes

Are there any "light-weight" FEM packages around?

I think you have some confusion. PETSc is not in the same league as Fenics, Libmesh, Moose etc. In fact, all of these (heavyweight) packages use PETSc for linear algebra. IMHO PETSc is as lightweight ...
stali's user avatar
  • 1,759
4 votes

Practical reference on sparse linear solvers for PDEs (Navier-Stokes, Poisson) and on learning PETSc

Wow! A question that I can answer! I have been using PETSc for the past year and a half to solve the Navier-Stokes equations (with some hard-coded MPI). The best way to learn PETSc is to (1) read ...
EssentialAnonymity's user avatar
4 votes

Are there any "light-weight" FEM packages around?

I can recommend nutils. nutils meets at least a few your "light-weight" requirements. it is pure python and easy to install since it only depends on standard Python libraries numpy, scipy, and ...
Jan's user avatar
  • 3,418
4 votes
Accepted

What method to solve a sparse complex symmetric (non-Hermitian) system?

Such problems can be solved using an $LDL^T$ factorization (similar in memory and time cost to Cholesky). Your matrix is not very sparse so treating it as such may have limited benefit. I would ...
Jed Brown's user avatar
  • 25.7k
4 votes
Accepted

How to solve a linear problem A x = b in PETSC when matrix A has zero diagonal enteries?

Use of Lagrange multipliers produces a saddle-point problem, $$ \begin{pmatrix} A & B^T \\ B & 0 \end{pmatrix} \begin{pmatrix} u \\ \lambda \end{pmatrix} = \begin{pmatrix} b \\ 0 \end{pmatrix} ...
Jed Brown's user avatar
  • 25.7k
4 votes
Accepted

Solution of linear system doesn't work, in parallel

ILU is not implemented for non-sequential matrices, see here.
Lilla's user avatar
  • 259
3 votes
Accepted

Which iterative method and preconditioner from petsc should be used when solving linear algebra in parallel?

There are many methods for solving linear systems in parallel, but fundamentally what works and what doesn't depends crucially on the properties of the linear system you are trying to solve. Among ...
Wolfgang Bangerth's user avatar
3 votes
Accepted

Practical reference on sparse linear solvers for PDEs (Navier-Stokes, Poisson) and on learning PETSc

If you're looking for a book and are happy with finite element discretizations, you can check out Elman, Silvester, and Wather, "Finite Elements and Fast Iterative Solvers". If you prefer finite ...
Jed Brown's user avatar
  • 25.7k
3 votes

Linear solvers: How to deal with a singular system? (Poisson equation with Neumann boundary conditions)

Krylov solvers have no problem converging if the system is consistent, i.e., if the right-hand side is in the image of the system matrix $A$; see, e.g., Iterative Krylov Methods for Large Linear ...
Nico Schlömer's user avatar
3 votes

PetSc vs Sundials for serial numerical computations?

As mentioned in Geoff Oxberry's more complete answer, it should be noted that PETSc includes TSSUNDIALS, an interface to SUNDIALS. If you configure PETSc with the ...
Patrick Sanan's user avatar
3 votes

PetSc vs Sundials for serial numerical computations?

In general, you can do more with PETSc. SUNDIALS is a collection of ODE solvers (in CVODE, Adams-Bashforth and BDF methods; in ARKODE, ARKIMEX methods) and DAE solvers (IDAS implements a BDF method) ...
Geoff Oxberry's user avatar
3 votes
Accepted

Send Petsc sequential matrix to another MPI rank

I don't think PETSc supports it. PETSc really thinks in parallel, so it converts at most between distributed matrices and sequential matrices through submatrix taking operations. I would MatGetArray ...
Victor Eijkhout's user avatar
3 votes
Accepted

How to efficiently fill in, in parallel, a PETSc matrix from a COO sparse matrix?

The problem is your loop iterates through all possible rows, but your COO data has more than that amount of data (only 5 rows, but you have 6 COO entries because you sum into position 0,0 twice). ...
helloworld922's user avatar
2 votes

The alternative to using PETSc's SNES solvers in parallel without using the DMDA methods

There is nothing about SNES that requires DMDA. Create a Vec distributed however you would ...
Jed Brown's user avatar
  • 25.7k
2 votes

How to deal with multi-region problems (in PETSc)

The strategy would really be very similar -- partition your matrix and vectors into "blocks" that correspond to the variables living on the different phases. The difference is really just that the ...
Wolfgang Bangerth's user avatar
2 votes

Algebraic multigrid in PETSc

AMG can be used with all examples in PETSc. There are three robust implementations that you might want to use -pc_type gamg is a native (smoothed) aggregation ...
Jed Brown's user avatar
  • 25.7k
2 votes
Accepted

Why does PETSc matrix memory allocation improve performance so much?

Warning: this answer is only going to give a brief overview, for the real details, the one source that won't be wrong is the source code. The core matrix AIJ format is basically the same as the one ...
origimbo's user avatar
  • 2,249
2 votes

Linear solvers: How to deal with a singular system? (Poisson equation with Neumann boundary conditions)

The problem I imagine you are trying to solve is a diffusion equation with source term with homogeneous Neumann BC. To do so it must be well posed in order to obtain physical and good results. The ...
HBR's user avatar
  • 1,648
2 votes
Accepted

is it more efficient to use ghosted vector in PETSC for PDE solving on unstructured mesh?

VecGhost can be useful if copying the interior values as part of a global-to-local (halo update) is expensive. The memory access pattern of a dedicated local vector ...
Jed Brown's user avatar
  • 25.7k
2 votes

Which python library for GPU sparse linear system solver library

I have found pycuda particularly useful as wrapper for cuda in python. Especially the section on metaprogramming is useful if you are interested in building more sophisticated frameworks. It's a ...
nluigi's user avatar
  • 277
2 votes

Practical reference on sparse linear solvers for PDEs (Navier-Stokes, Poisson) and on learning PETSc

What would be the best starting document for ... b) learning steps by steps? See my project to write an intro book on using PETSc to solve PDEs: https://github.com/bueler/p4pdes An early draft PDF ...
Ed Bueler's user avatar
2 votes
Accepted

PETSc - Manipulate BAIJ matrix locally

The solution I found for PETSc 3.7 was to use MatGetSubMatrices. Warning : this method is not present in the last API. I discovered that BAIJ is actually not ...
Matthias Beaupère's user avatar
2 votes

Why PETSc/MPI uses only 1 processor a number of times, rather than using several as prescribed by mpiexec

This behavior typically results from using the wrong mpiexec. It has to be the one from the MPI that you used to install petsc. For instance, if you did ...
Victor Eijkhout's user avatar
2 votes
Accepted

How to delete $n^{th}$ row and $n^{th}$ column of a matrix K in Petsc and restructure it?

You don't do that for large and sparse matrices. It's an inefficient operation. Rather, you zero out the $n$th row and column and put a nonzero entry on the diagonal. Then you think about what ...
Wolfgang Bangerth's user avatar
2 votes

Issue solving nonlinear equation containing a quotient

We can rewrite the equation as $ \frac{-2 f f'}{(1+f^2)^2} = \frac{f}{1+f^2} $ which reduces to $ f' = - \frac{1+f^2}{2} $ The latter does not have $1+f^2$ in the denominator, so it should not have ...
Maxim Umansky's user avatar
2 votes

Petsc Mat object in class

If you're looking for an example, take a look at the MatrixBase class here: https://github.com/dealii/dealii/blob/master/include/deal.II/lac/petsc_matrix_base.h ...
Wolfgang Bangerth's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible