# 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
make all


(note: I did not install mpich since it was already installed on the system)
Then, I tried to run an example from the following this tutorial, slide 46 of 197, which asks me to do the following:

cd ~/petsc-3.2-p6/src/snes/examples/tutorials
make ex5


In the process, I get the following errors:

makefile:24: /conf/variables: No such file or directory
makefile:24: /conf/rules: No such file or directory
makefile:24: /conf/test: No such file or directory


Is the problem in the way I setup PETSc? Or is there something I need to modify in the makefile?

You most likely haven't set the PETSC_DIR and PETSC_ARCH environment variables correctly.

For instance, you misspelled PETSC_DIR as PETC_DIR in the third line of your build example.

• Sometimes, the simplest mistakes are often the hardest to see on your own! :) Thanks for the help. I got got it to work now. – Paul Jan 20 '12 at 20:10