Installing PETSc 2.1.0 on Mac OS X 10.3

PETSc is the Portable, Extensible Toolkit for Scientific Computation (PETSc homepage). It utilizes the Basic Linear Algebra Subprograms package (BLAS) and the Linear Algebra Package (LAPACK).

Here are the steps I took to install PETSc 2.1.0 on a Mac running OS X 10.3:

  1. Download and install MPICH, which is a message-passing interface (MPI) implementation. I wrote up some notes here.

  2. Expand the PETSc package to /usr/local/petsc/ (or wherever you want to put PETSc), and set the PETSC_DIR and PETSC_ARCH environmental variables. This can be done by adding the following lines to ~/.bash_profile and/or ~./bashrc:

    # set environmental variables for PETSc
    export PETSC_DIR=/usr/local/petsc/petsc-2.1.0/
    export PETSC_ARCH=macx


    Don't forget to source ~/.bash_profile and/or ~/.bashrc after making the change. Alternatively, you can set the variables each time from the command line:

    PETSC_DIR=`pwd` ; export PETSC_DIR
    PETSC_ARCH=macx ; export PETSC_ARCH


  3. PETSc 2.1.0 is configured using files in the ${PETSC_DIR}/bmake/macx/ directory. You can have a look at the way I set up base.site and base_variables.

  4. Build with the debug C target and run the test script:

    sudo make BOPT=g all >& make_log_g
    sudo make BOPT=g testexamples >& examples_log_g


  5. Build and test with whatever other targets you want, e.g. the optimized c target BOPT=O.