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.

It supports MPI, shared memory pthreads, and NVIDIA GPUs, as well as hybrid MPI-shared memory pthreads or MPI-GPU parallelism. The home page is http://www.mcs.anl.gov/petsc/

158 questions
7
votes
2 answers

How can I tell which options PETSc was compiled with?

I'm working on a machine with a version of PETSc compiled by someone else. Is there a straightforward way to find out which options were used at compile time from the installation itself? For example, is there a file that has all of the compile…
Dan
  • 3,355
  • 3
  • 21
  • 47
5
votes
1 answer

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 to istart + size - 1, rather than from 0 to size - 1, or a multidimensional array…
jjramsey
  • 198
  • 6
4
votes
1 answer

How to run a PETSc example?

I just installed the PETSc library. This is what I did from the home directory ~ gunzip -c petsc-3.2-p6.tar.gz|tar -xof - cd ~/petsc-3.2-p6 PETC_DIR=$PWD: export PETSC_DIR ./configure --download-f-blas-lapack=1 make all make…
Paul
  • 12,045
  • 7
  • 56
  • 129
4
votes
1 answer

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 --download-f-blas-lapack --download-mpich" and…
Shainath
  • 489
  • 2
  • 12
4
votes
1 answer

Memory footprint for DMDA objects in PETSc

Why does DMDA objects require so much memory on PETSc 3.2-p7. When running the code: ... N = 8000; ierr = DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_PERIODIC, DMDA_BOUNDARY_PERIODIC, DMDA_STENCIL_STAR, N, N, size, PETSC_DECIDE,…
Eldila
  • 340
  • 1
  • 8
4
votes
1 answer

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 that one use a Scatter object. Is using scatter…
Hui Zhang
  • 1,319
  • 7
  • 16
4
votes
1 answer

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 skip this? From the source code of Petsc, it seems…
Hui Zhang
  • 1,319
  • 7
  • 16
4
votes
1 answer

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 is a problem with the way Petsc is compliled (I…
Andrew Spott
  • 1,155
  • 1
  • 9
  • 22
3
votes
1 answer

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 retrieve the ghost cell values from neighbouring processes, I simply use the…
Eldila
  • 340
  • 1
  • 8
3
votes
0 answers

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 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 preconditioner run better. I've tried several…
UsingPETSc
  • 31
  • 1
3
votes
2 answers

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 somewhere in A (or xxx). In other words, shall I…
Hui Zhang
  • 1,319
  • 7
  • 16
3
votes
1 answer

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 of the things I added was MatGetOwnershipRange()…
Dan
  • 3,355
  • 3
  • 21
  • 47
3
votes
0 answers

PETSc: KSP gives strange discontinuity at the edge between MPI processes

I'm using PETSc's SNES linesearch (NEWTONLS) to solve a system of nonlinear PDEs. SNES+KSP successfully solved a test problem of the same type before without any trouble. However, with my current problem, if I use the KSP to invert the Jacobian, the…
2
votes
0 answers

PETSc KSP Tutorial ex7 Output

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 use PCBJACOBI, setting different solvers for…
Adriano
  • 63
  • 3
2
votes
1 answer

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 Vec local; ierr =…
smilingbuddha
  • 645
  • 5
  • 10
1
2