Questions tagged [petsc]
PETSc is an open source suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations.
151
questions
5
votes
2answers
1k views
Computing matrix exponential with PETSc/SLEPc
My question is basically the best way to compute the matrix exponential in parallel. I've got a sequential code written in Python (https://github.com/hadsed/AdiaQC) and I need to extend it to run in a ...
2
votes
0answers
415 views
PETSC Memory Leak [closed]
I tried to use PETSC direct solver (SUPER LU) to solve the system of equations.
After a long time effort, the code is working properly and gives some good results. The only issue that came up recently ...
2
votes
0answers
590 views
Cusp Library performance worse than PETSC (GMRES 200 iterations) Why?
I wanted to compare the speeds of the GMRES implementations in the CUSP and the PETSc libraries.
The matrix (A) used for testing was a 3d Laplacian matrix obtained by using the 7 point stencil on a ...
4
votes
1answer
382 views
About PETSc installation
I have downloaded and unzipped PETSc from PETSc Website in my home directory (OS is CentOS 6.3 64bit ) and followed given commands on Installation page "./configure --with-cc=gcc --with-fc=gfortran -...
6
votes
1answer
2k views
MPI-based Implementations of FFT
In a numerical computation, I am required to take a multi-dimensional FFT on a distributed-memory cluster. The data is currently distributed using a distributed array in PETSc (DMDA).
I initial ...
4
votes
1answer
549 views
PETSc's makefile system can't find MKL
I'm learning PETSc and trying to make the examples written in C. However, when I use the provided makefile, I get the following error:
...
10
votes
1answer
2k views
Solving a simple Ax=b system in parallel with PETSc
I am new to the PETSc package.
I have a ~4000x4000 matrix A in matrix-market format and I want to get PETSc to solve this using multiple processors.
I know how to solve the system on a single ...
4
votes
3answers
1k views
CPU benchmarks for numerical kernels
CPU benchmarks available online mostly focus on desktop apps/games and rarely on serial/parallel numerical kernels, specially sparse ones (e.g., MatMult). Some benchmarks like NAS/SciMark exists but ...
8
votes
1answer
612 views
Using algebraic multigrid for preconditioning convection-diffusion operators
I implemented a Navier Stokes based on FEM discretization and PETSc for solving the linear system of equations. To create an efficient solution procedure, I follow the paper "Efficient ...
8
votes
1answer
2k views
How to get sparse complex matrices from my code to PETSc efficiently
What is the most efficient way to get a complex sparse matrix from my Fortran code to PETSc? I understand that this is problem dependent, so I tried to give as many relevant details as possible below.
...
15
votes
1answer
4k views
How can I estimate the condition number of a large sparse matrix using PETSc?
I have a PETSc Mat and would like to estimate its condition number.
3
votes
1answer
227 views
Using same memory space for global and local Petsc DA Vectors
I have constructed a local and global distributed array in Petsc 3.2 using:
DMCreateGlobalVector(da, &v);
DMCreateLocalVector(da, &lv);
In order to ...
6
votes
1answer
166 views
Is there a way to inspect the graph of a sparse matrix with PETSc?
I am currently trying to code the CA-CG method within the PETSc framework. A mandatory step in this process is the implementation of the "matrix powers kernel" algorithm for a generic sparse matrix.
...
2
votes
1answer
141 views
Factor a non-symmetric matrix into the product of a sparse symmetric matrix and a diagonal matrix plus a low rank correction
I have a non-symmetric matrix, where the non-symmetry only appears at a subset of points. This arises due to the particular manner on which boundary conditions are applied in a Cartesian grid method. ...
1
vote
1answer
87 views
Debugging Shell matrix
I am trying to solve complex valued Poisson equation
$$(C + \nabla. D \nabla )u = f \text{ ;where C, D, u and f are complex numbers.} $$
I am breaking this eqn into real valued problem, which is of ...
2
votes
2answers
572 views
What are d_nz and o_nz in PETSc's MatMPIAIJSetPreallocation function?
I'm working from ex2.c of PETSc's example codes. On line 65, the code specifies:
MatMPIAIJSetPreallocation(A,5,PETSC_NULL,5,PETSC_NULL);
I looked up the ...
4
votes
1answer
354 views
Memory footprint for DMDA objects in PETSc
Why does DMDA objects require so much memory on PETSc 3.2-p7.
When running the code:
...
11
votes
2answers
6k views
How to work with function pointers in Fortran in scientific programs
Here is a typical usage of function pointers in C. I would like to do something similar in Fortran. I have some ideas, but I would like to know if there is some canonical way to do so.
The function ...
8
votes
1answer
353 views
Is the sparsity pattern of a linear system important for iterative (KSP) solvers?
Pretty much the question. Given a general sparse, non-symmetric (both numerically and structurally) matrix, how important is the sparsity pattern (i.e. row/column permutation of matrix/vector) for ...
3
votes
1answer
940 views
32bit/64bit issue when working with Numpy and petsc4py
When indexing PETSc.Mat A with an array c ( numpy.ndarray with ...
10
votes
1answer
828 views
Does PETSc ever make use of LAPACK libraries for sparse matrix math?
Does compiling PETSc with an external BLAS/LAPACK library significantly affect performance on sparse matrices, or does it only use those libraries for dense matrix math?
3
votes
2answers
192 views
Petsc's xxxSetxxx methods: Own Pointer or Copy Values?
In PETSC, there are many xxxSetyyy methods, e.g. MatSetLocalToGlobalMapping(A,rmap,cmap). I wonder whether contents of rmap and cmap (or generally yyy, that set to xxx) pointing to are copied to ...
2
votes
1answer
28 views
How do I print a PetscBag to a specific file?
I have a PetscBag in my program that I want to write to a filename I have stored as a string. If I want to write to stdout, there is a pre-made PetscViewer macro ...
4
votes
1answer
462 views
When is MatGetArray/VecGetArray useful?
In petsc, there are already SetValues(Local) methods. But when does one need GetArray methods?
A related question: to copy a portion of a Mat/Vec to part of another Mat/Vec, it is usually suggested ...
4
votes
2answers
1k views
How should I build a 2D 5-point stencil Laplacian matrix in parallel?
I'm making a simple eigenvalue solver with SLEPc, using a 5-point stencil and the finite difference method. I want to be able to assemble the matrix in parallel.
My first thought was just to use <...
4
votes
1answer
242 views
Do I need KSPSetOperators after PCSetOperators?
What I did is
Create some PC named pc, and PCSetOperators(pc,A,A,..);
Create KSP named ksp;
KSPSetPC(ksp,pc);
After the above process, am I still obliged to KSPSetOperators(ksp,A,A,..), or I can ...
5
votes
1answer
210 views
What is the difference between MATSEQMAIJ and MATSEQAIJ in PETSc?
What is the difference between MATSEQMAIJ and MATSEQAIJ in PETSc?
Also, where can I find more information on each of the MatTypes? I went to the MatType documentation, but it didn't have anything but ...
11
votes
2answers
2k views
Efficiency of using petsc4py vs. c/c++/fortran
How much slower is petsc4py vs c/c++/fortran?
I realize it will depend significantly on the code being executed, but what about something simple like a matrix-vector product?
6
votes
1answer
106 views
How do you change the desired accuracy of a TS object in PETSc?
I'm currently getting very long propagation times when attempting to use the Time Stepping propagators in Petsc 3.2, and in the interest of speeding things up, I'm curious how I can reduce the ...
3
votes
1answer
226 views
What does MatGetOwnershipRange() do for sequential matrices?
I'm writing a petsc code using a sequential matrix type. Since I want it to be easy to parallelize, I put some stuff in the code that is useless now, but will make it easier to parallelize later.
One ...
3
votes
0answers
157 views
Is there an easy way to read a PetscBag into a python dict?
I'm using a PetscBag to store the input parameters of my program. At some point, I'm going to need to use python to plot these parameters against some output parameters, and ...
4
votes
1answer
212 views
MatMatMult and KSPSolve for MATMPIDENSE matrices
I'm trying to use MATMPIDENSE matrices to solve a system of type Ax=b, but I have some problems. The KSP documentation says that KSPSolve for dense matrices requires to set a 'gmres' solver and a 'lu' ...
1
vote
1answer
229 views
Error message when trying to get PETSc to draw to an X terminal by passing -mat_view_draw
I've made a matrix, and now I want to draw it on the screen to make a basic check of correctness. The documentation for MatAssemblyEnd() states that I can pass an ...
2
votes
1answer
575 views
Implicitly casting PetscReal to the real part of PetscComplex
The version of Petsc installed on my machine has PetscScalar set to be complex. I am making a matrix which has all real entries.
Something like the following code compiles:
...
3
votes
2answers
461 views
Why can't I compile a function using the CHKERRQ macro in PETSc?
I wrote a function to read in the runtime parameters my program takes. This function is in a different file than my main program; the two object files are linked after compilation.
When I compile the ...
2
votes
1answer
96 views
What should a PetscBag be used for?
I've been trying to use a PetscBag to read in a number of options I want to pass to a program I'm writing. Before I came across the documentation for PetscBag, I was planning on using a struct and a ...
2
votes
1answer
60 views
Can PetscBags be used with 64 bit versions of petsc?
I was looking at the documentation for PetscBagCreate(), and it says that
The size of the A struct must be small enough to fit in a PetscInt; by default ...
1
vote
1answer
58 views
What does PetscBagSetFromOptions() do?
I'm writing a program that uses PETSc and SLEPc, and I was looking for a convienient way to read in options from the command line. The description of ...
4
votes
3answers
337 views
Overlapping communication and computation in PETSc and/or Trilinos?
I am just learning about these packages, so forgive me if this is a trivial/silly question.
Our group is working re-developing our code from the ground up using modern software practices. Currently ...
4
votes
1answer
613 views
Petsc not compiling c++ files
I'm having a problem where petsc is complaining about the type of PetscScalar (I get a whole bunch of errors from the c++ standard library that revolve around PetscScalar not defined).
I believe it ...
4
votes
3answers
2k views
How do I read a binary file into PETSc as a matrix?
I created a binary matrix using the following loop in c
...
14
votes
2answers
2k views
How useful is PETSc for Dense Matrices?
Wherever I have seen, PETSc tutorial/documents etc. say that it is useful for linear algebra and usually specifies that sparse systems will benefit. What about dense matrices? I am concerned about ...
9
votes
2answers
2k views
How do I compute the parallel overhead of a parallel code run on a single processor when no sequential code is available?
I'm profiling the performance of PETSc's linear solvers. As I understand it,
$$\text{speedup}=\frac{\text{Sequential Time}}{\text{Parallel Time}}.$$
I know that running the parallel code on one ...
25
votes
5answers
7k views
What are the main differences between PETSc and Trilinos?
As far as I can tell, the two big generic US Department of Energy computational science software frameworks are PETSc and Trilinos. They seem similar at first glance, beyond differences in language (...
2
votes
1answer
1k views
How to measure the overall performance of a PETSc program using the -log_summary flag?
When I run a PETSc example in parallel with the flag "-log_summary", the first two tables of information look something like this:
...
3
votes
1answer
2k views
Problems running a PETSc example in parallel
After configuring and building PETSc, I have successfully been able to run several examples. In particular, I am working with this example. I have been able to run the program using the following ...
4
votes
1answer
2k views
How to run a PETSc example?
I just installed the PETSc library. This is what I did from the home directory ~
...
27
votes
2answers
13k views
Why is my iterative linear solver not converging?
What can go wrong when using preconditoned Krylov methods from KSP (PETSc's linear solver package) to solve a sparse linear system such as those obtained by discretizing and linearizing partial ...
7
votes
2answers
722 views
Is it possible to dynamically resize a sparse matrix in the Petsc library?
This may be a Petsc newbie question, but...
I'm using Petsc to solve a large sparse linear system. The initial creation of the matrix is fairly slow, which I'm given to understand is largely due to ...
17
votes
2answers
1k views
Which libraries have good high-level support for multigrid?
I'm planning to use multigrid to calulate some eigenvalues and vectors, and I noticed PETSc has high-level support for multigrid. The PETSc documentation says that this part of PETSc should not be ...