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.
158
questions
5
votes
1
answer
285
views
Is PETSc's DMDA relying on undefined behavior?
I was looking at the documentation for DMDAVecGetArray and was surprised that it could create a plain ordinary C array whose indices somehow ranged from, say, istart...
6
votes
3
answers
619
views
Preconditioner for finding the smallest eigenpairs of a large, but structured, matrix
I'm trying to find the eigenvector corresponding to the second smallest eigenvalue of a large $(4,000,000 \times 4,000,000)$ matrix $L$. $L$ is a graph Laplacian, with the following structure: $L = D -...
5
votes
2
answers
2k
views
Solve a linear system with BiCGStab instead of GMRES in PETSC
Below a piece of code is shown to solve a linear system.
...
2
votes
0
answers
113
views
PETSc KSP Tutorial ex7 Output [closed]
I am learning PETSc following the tutorials of the distribution (version 3.4.1). My question is about the KSPView(ksp,PETSC_VIEWER_STDOUT_WORLD); (line 216) of ex7.c (KSP tutorial).
It teaches how to ...
5
votes
1
answer
1k
views
Basic questions regarding slepc4py/petsc4py
I am brand new to slepc4py and petsc4py (and SLEPc and PETSc in general), and I have a few basic questions. I apologize if these have been answered somewhere - I've looked around for a while and haven'...
2
votes
1
answer
613
views
PETSc Krylov Subspace and nullspace
How is the nullspace correction implemented in the PETSc conjugate gradient solver? I searched the source code and documentation, but could not find references on the actual implementation.
For ...
6
votes
1
answer
225
views
Advice on solving a coupled physics problem
I am taking a shot at solving a coupled physics problem. I have this matrix formed:
$\mathbf{J}=\begin{bmatrix}
\mathbf{A} & \mathbf{B}\\
\mathbf{C} & \mathbf{D}
\end{bmatrix}$
where $\...
3
votes
2
answers
341
views
Is there MPI_Star instead of MPI_Win (window) for MPI_Get?
In FEM applications, each processor needs only data from neighboring processors, which gives a stencil or star pattern of communication. In MPI_Win for MPI_Get, one needs to setup a group of ...
4
votes
2
answers
758
views
What is the basic requirement to understand the PETSc library?
I want to use the PETSc library to do some numerical work on finite element and parallel computing, but I wonder what I should know first to use these libraries. Could you give me some guiding ...
4
votes
2
answers
127
views
Installing only a portion of PETSc
I want to incorporate matrix solver into my program. Is it possible to separate out any library of matrix solver from PETSc? I am working in C language. It will be very helpful if I get any library ...
6
votes
1
answer
548
views
Reference BLAS/LAPACK from NETLIB is twice as fast as MKL for complex numbers
I'm solving the Helmholtz equation using PETSc. I found with the PETSc configure option --download-f-blas-lapack my program runs twice as fast over running it with ...
2
votes
1
answer
978
views
Creating a local vector in a parallel PETSC program
In one of my PETSc programs, I need a processor to access values from another processor.
So in the PETSc FAQ's this issue has been briefly addressed here.
To create a local vector, I tried this
<...
5
votes
2
answers
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
0
answers
526
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
0
answers
599
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
1
answer
451
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
1
answer
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
1
answer
615
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
1
answer
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 ...
8
votes
1
answer
732
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
1
answer
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.
...
16
votes
1
answer
5k
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
1
answer
266
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
1
answer
189
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
1
answer
148
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
1
answer
100
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
2
answers
653
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
1
answer
382
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:
...
13
votes
2
answers
8k
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
1
answer
373
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
1
answer
1k
views
32bit/64bit issue when working with Numpy and petsc4py
When indexing PETSc.Mat A with an array c ( numpy.ndarray with ...
10
votes
1
answer
1k
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
2
answers
216
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
1
answer
36
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
1
answer
547
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
2
answers
2k
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
1
answer
265
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
1
answer
253
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
2
answers
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
1
answer
115
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
1
answer
244
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
0
answers
170
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
1
answer
223
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
1
answer
267
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 ...
3
votes
2
answers
550
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
1
answer
100
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
1
answer
67
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
1
answer
67
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
3
answers
390
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
1
answer
643
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 ...