PETSc is an open source suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations.

learn more… | top users | synonyms

5
votes
1answer
74 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 ...
8
votes
2answers
70 views

Which preconditioners (and solver) in PETSc for indefinite symmetric systems should I use?

My system is a symmetric FE problem with lagrange multipliers (e.g. incompressible Stokes' flow): \begin{pmatrix}A & B^T \\ B & C\end{pmatrix} where $C = 0$ is the typical case (I have even ...
2
votes
1answer
26 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 ...
-1
votes
0answers
43 views

Pre-stressing within fenics

How can I go about incorporating pre-stressing into a code using fenics. In particular what I have is a code which creates a mesh, applies external forces and calculates the displacement based on min ...
4
votes
2answers
126 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 ...
0
votes
0answers
52 views

A PETsc installation/usage problem

I am working in Windows, so I have installed cygwin, then followed the procedure of this page and succeed, but when I have included "petsc.h" in VS2010, the "petsclog.h" could not pass the ...
1
vote
0answers
41 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 ...
2
votes
0answers
74 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 ...
10
votes
4answers
169 views

Calculation of the sparsity structure for finite element matrices

Question: What methods are available to accurately and efficiently calculate the sparsity structure of a finite element matrix? Info: I'm working on a Poisson Pressure Equation solver, using ...
2
votes
0answers
75 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
72 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 ...
5
votes
1answer
117 views

preconditioner for a matrix-free method to solve Ax=b

I need to solve Ax=b, but I realize that even if it is sparse, storing the matrix coefficients of my problem will take too much memory. So now I'm considering using a matrix-free method, because the ...
4
votes
1answer
108 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 ...
6
votes
3answers
170 views

Sparse linear solver for many right-hand sides

I need to solve the same sparse linear system (300x300 to 1000x1000) with many right hand sides (300 to 1000). In addition to this first problem, I would also like to solve different systems, but with ...
9
votes
1answer
157 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 ...
3
votes
3answers
247 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 ...
5
votes
1answer
138 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 preconditioning ...
4
votes
1answer
151 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. ...
2
votes
1answer
51 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 ...
5
votes
1answer
102 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
72 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. ...
3
votes
0answers
101 views

How do I configure PETSc to run long double precision or some other precision that is greater than default?

I'm installing PETSc for complex numbers with C99 standard. I'd like to have it installed using a higher precision than default (double, I presume) since that will most likely make the LU ...
0
votes
1answer
66 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 ...
8
votes
3answers
385 views

Thrust for GPU programming

I'm very new to GPGPU programming so please forgive me if the question is not particularly appropriate. From what I understand GPU programming is a very intricate piece of engineering work when ...
2
votes
2answers
105 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 ...
3
votes
1answer
114 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: ...
7
votes
1answer
156 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 ...
7
votes
3answers
242 views

What is a robust, iterative solver for large 3-d linear-elastic problems?

I'm diving into the fascinating world of finite element analysis and would like to solve a large thermo-mechanical problem (only thermal $\rightarrow$ mechanical, no feedback). For the mechanical ...
3
votes
1answer
144 views

32bit/64bit issue when working with Numpy and petsc4py

When indexing PETSc.Mat A with an array c ( numpy.ndarray with ...
7
votes
1answer
206 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
100 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
20 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 ...
3
votes
1answer
108 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 ...
3
votes
2answers
255 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
49 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 ...
4
votes
1answer
54 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 ...
8
votes
2answers
364 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
58 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
76 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 ...
4
votes
1answer
80 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
84 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
0answers
109 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 ...
2
votes
1answer
89 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: ...
2
votes
2answers
99 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
57 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
42 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
38 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 ...
3
votes
1answer
239 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
157 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 ...
3
votes
3answers
375 views

How do I read a binary file into PETSc as a matrix?

I created a binary matrix using the following loop in c ...

1 2