# 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.

141 questions
Filter by
Sorted by
Tagged with
115 views

### Writing a 3D array from Petsc

I am trying to do something fairly simple somehow I have made it hard. Is there an example of how to send a 3D array to a binary file?
356 views

### Applying Dirichlet b.c. to the Eigenvalue-Problem

If you use a FEM (on the variational formulation), you can discretize some continuous eigenvalue problem, $$L u = \lambda u \ \ \text{on} \ \Omega,$$ into some discrete, generalized eigenvalue problem,...
301 views

3k views

### Any recommendations for unit-testing frameworks compatible with code/libraries that use MPI?

Usually, I write serial code, and when I do, I write unit tests with some xUnit-style testing framework (MATLAB xUnit, PyUnit/nose, or Google's C++ testing framework). Based on a cursory Google ...
377 views

### PETSc: Blocking matrices using MatCreateSeqBAIJ and MatSetValuesBlocked

I am a little confused with PETSc's documentation for MatSetValuesBlocked. The code below works fine for matrices when I choose small block sizes, but I get errors ...
1k views

### Solve a linear system with BiCGStab instead of GMRES in PETSC

Below a piece of code is shown to solve a linear system. ...
106 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 ...
815 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'...
894 views

### Solving a large non-hermitian generalised eigenvalue problem from a linear stability analysis using SLEPc

I have a generalised matrix problem: $A x = \lambda B x$ from a spectral method on a linear stability analysis problem. My matrix B is diagonal and positive semi-definite. A is non-hermitian and ...
446 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 ...
211 views

859 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 <...
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 ...
303 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 ...
369 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 ...
2k 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 Galerkin'...
585 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 ...
363 views

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 -...
1k 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 ...
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 ...
2k 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 ...
1k 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 ...
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 ...
556 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 ...
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. ...
213 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 ...
160 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. ...
127 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. ...
456 views

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

I'm installing PETSc for complex numbers with the C99 standard. I'd like to have it installed using a higher precision than the default (double, I presume) since that will most likely make the LU ...
85 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 ...
2k 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 ...
528 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 ...