Petsc: Difference between revisions
From charlesreid1
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
PETSc is the Portable Extensible Toolkit for Scientific Computation. It's used for the parallel solution of PDEs and provides parallel linear and nonlinear solvers. PETSc is written in C. | |||
= Installation = | = Installation = | ||
== Petsc 2.3.3 == | == Petsc 2.3.3 == | ||
Petsc can be installed using the following configure line. This will require installation of MPI (I suggest [[LAM MPI]]). | Petsc 2.3. can be installed using the following configure line. This will require installation of MPI (I suggest [[LAM MPI]]). | ||
<syntaxhighlight> | <syntaxhighlight> | ||
/path/to/source/petsc-2.3.3 | /path/to/source/of/petsc-2.3.3/config/configure.py \ | ||
--prefix=/path/to/petsc-2.3.3 \ | --prefix=/path/to/petsc-2.3.3 \ | ||
--with-matlab=false \ | --with-matlab=false \ | ||
--with-x=false \ | --with-x=false \ | ||
--with-shared=0 \ | --with-shared=0 \ | ||
--with-mpi-dir=/path/to/ | --with-mpi-dir=/path/to/mpi \ | ||
PETSC_DIR= | PETSC_DIR=/path/to/source/of/petsc-2.3.3 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 25: | Line 26: | ||
# make install | # make install | ||
# make test (this script should pass all tests OK) | # make test (this script should pass all tests OK) | ||
== Petsc 3.0.0 == | |||
Petsc 3.0.0 can be installed using the configure line: | |||
<syntaxhighlight> | |||
/path/to/source/of/petsc-3.0.0/config/configure.py \ | |||
--prefix=/path/to/petsc-3.0.0 \ | |||
--with-matlab=false \ | |||
--with-x=false \ | |||
--with-shared=0 \ | |||
--with-mpi-dir=/path/to/mpi \ | |||
PETSC_DIR=/path/to/source/of/petsc-3.0.0 | |||
</syntaxhighlight> | |||
The build process is similar to the above: | |||
# run the configure wrapper | |||
# turn on lam with lamboot (or whatever MPI you're using) | |||
# make all | |||
# make install | |||
# make test (this script should pass all tests OK) | |||
= Building with Petsc = | |||
== Source code == | |||
There are a number of different header files that must be included in any source code that uses PETSc objects or functions. These must be included by using: | |||
<code>#include "headerfile.h"</code> | |||
Depending on the functionality used, different header files must be used. | |||
{|class="wikitable" | |||
!Header file | |||
!Function | |||
|- | |||
|petsc.h | |||
|generic header file, should be included unless another header file would be more applicable | |||
|- | |||
|petscvec.h | |||
|vector structure and functions | |||
|- | |||
|petscmat.h | |||
|matrix structure and functions | |||
|- | |||
|petscksp.h | |||
|functions solving linear systems using Krylov subspace methods | |||
|- | |||
|petscpc.h | |||
|preconditioner structure and functions | |||
|} | |||
[[Category:Software]] | |||
[[Category:Computers]] | |||
Revision as of 10:35, 29 November 2010
PETSc is the Portable Extensible Toolkit for Scientific Computation. It's used for the parallel solution of PDEs and provides parallel linear and nonlinear solvers. PETSc is written in C.
Installation
Petsc 2.3.3
Petsc 2.3. can be installed using the following configure line. This will require installation of MPI (I suggest LAM MPI).
/path/to/source/of/petsc-2.3.3/config/configure.py \
--prefix=/path/to/petsc-2.3.3 \
--with-matlab=false \
--with-x=false \
--with-shared=0 \
--with-mpi-dir=/path/to/mpi \
PETSC_DIR=/path/to/source/of/petsc-2.3.3To make this a debug build, add --with-debugging=1 to the configure line.
The build process consists of:
- run the configure wrapper
- turn on lam with lamboot (or whatever MPI you're using)
- make all
- make install
- make test (this script should pass all tests OK)
Petsc 3.0.0
Petsc 3.0.0 can be installed using the configure line:
/path/to/source/of/petsc-3.0.0/config/configure.py \
--prefix=/path/to/petsc-3.0.0 \
--with-matlab=false \
--with-x=false \
--with-shared=0 \
--with-mpi-dir=/path/to/mpi \
PETSC_DIR=/path/to/source/of/petsc-3.0.0The build process is similar to the above:
- run the configure wrapper
- turn on lam with lamboot (or whatever MPI you're using)
- make all
- make install
- make test (this script should pass all tests OK)
Building with Petsc
Source code
There are a number of different header files that must be included in any source code that uses PETSc objects or functions. These must be included by using:
#include "headerfile.h"
Depending on the functionality used, different header files must be used.
| Header file | Function |
|---|---|
| petsc.h | generic header file, should be included unless another header file would be more applicable |
| petscvec.h | vector structure and functions |
| petscmat.h | matrix structure and functions |
| petscksp.h | functions solving linear systems using Krylov subspace methods |
| petscpc.h | preconditioner structure and functions |