Introduction

The PETSc (Portable, Extensible Toolkit for Scientific Computation) library
"is a suite of data structures and routines for the scalable (parallel)
solution of scientific applications modeled by partial differential equations."
It provides a useful framework of parallel data structures, solvers,
preconditioners, etc, so that you can focus on solving your PDE problem.
In this tutorial, we'll show how to build and run one of the examples that
comes with PETSc, which solves a "variable Poisson" problem. We will not discuss
the details of problem here, we will just focus on getting the example to
run on tara. Before you begin, make sure to read the
tutorial for compiling C programs.

Where to find documentation

PETSC is thoroughly documented by its authors at the
PETSc home page. On tara,
PETSc is installed in the following locations (corresponding to the
currently available MPI/compiler combinations):

/usr/cluster/contrib/gcc-mvapich2-1.4rc2/petsc-3.0.0-p9/cxx-opt/

/usr/cluster/contrib/gcc-openmpi-1.3.3/petsc-3.0.0-p9/cxx-opt/

/usr/cluster/contrib/pgi-9.0-mvapich2-1.4rc2/petsc-3.0.0-p9/cxx-opt/

/usr/cluster/contrib/pgi-9.0-openmpi-1.3.3/petsc-3.0.0-p9/cxx-opt/

Each location has an "include" directory with PETSc header files which you can
browse.

Example

The example we'll use is
ex13.c
. An easy way to get the example to your tara account is with wget. Notice that
we are retrieving the plain C file, and not the HTML-ized version.

Notice that the environment variable PETSC_DIR is used, but not defined in
this file. We will define it in our session before proceeding (if you forget to
do this, compiling and execution will fail!). We will assume
you're using the default PGI+MVAPICH2 switcher setting, so execute the following
commands.

Running the example through the batch system requires no special effort. As
long as your environment variables are set correctly, your executable
should be able to find the PETSc runtime libraries. As a quick example,
the following batch script should be sufficient.