You are here


PETSc is a toolkit to facilitate the development of parallel scientific applications involving the solution of partial differential equations. It provides such things as parallel solvers for linear and nonlinear problems, preconditioners and data strutures for the representation of sparse parallel matrices.

There are many optional add-ons to PETSc which makes it difficult to maintain in a public directory.

If you plan to use PETSc on WestGrid, please write to to discuss whether you should maintain PETSc in your own directory or whether your requirements are sufficiently generic to use a version installed by WestGrid staff.

Running PETSc on Bugaboo

The petsc library and include files are in the default search path of the compilers, thus no loading of modules is required.

In order to compile with the Petsc library add the -lpetsc argument to the compile command, e.g.,

mpif90 -O3 -o ex2f ex2f.F -lpetsc

PETSc examples are in /usr/local/petsc/examples.

Running PETSc on Grex


module avail

to see a list of modules that are used to set up the environment for certain software on Grex, including PETSc.

To use the default version (PETSc 3.4.2, at the time of this writing), type:

module load petsc

or you can set up the equivalent environment with:

module load petsc/3.4.2-i32

The i32 in the module name is there to emphasize that this version was built with the 32-bit integer interface to the Intel MKL (Math Kernel Library).

Loading the petsc module defines a directory PETSC_DIR and other environment variables. It will also load necessary dependency modules such as NetCDF. You can see the full set of environment changes with the command:

module show petsc/3.4.2-i32

The installed version of PETSc 3.2-p5, was built with a number of the optional external packages including:

  • Hypre - Library of preconditioners from Lawrence Livermore National Laboratory, for help in solving large sparse linear systems.
  • MUMPS - MUltifrontal Massively Parallel sparse direct Solver.
  • ParMETIS - Parallel graph partitioning library.
  • SPOOLES - SParse Object Oriented Linear Equations Solver (sparse and complex systems).
  • SuperLU_Dist - Distributed memory version of the SuperLU library for direction solution of large, sparse, nonsymmetric systems.
  • ML
  • SPAI