install petsc by gcc and openmpi-1.6.5 on shenma cluster

You can find the source code and document from the following website:

http://www.mcs.anl.gov/petsc/documentation/installation.html

tar xzvf   petsc-3.5.4.tar.gz

./configure PETSC_DIR=/tmp/liuxj_build/petsc-3.5.4 PETSC_ARCH=linux-openmpi-gcc –prefix=/pkg/petsc/3.3/${PRG_ENV} –with-cc=mpicc –with-cxx=mpic++ –with-fc=mpif90 –with-mpi-lib=${MPI_ROOT}/lib/libmpi.a –with-mpi-include=${MPI_ROOT}/include –with-shared-libraries=0 –with-mpi=1 –with-mpi-compilers=mpicc –with-blas-lib=${BLASLAPACK_DIR}/lib/libblas.a –with-lapack-lib=${BLASLAPACK_DIR}/lib/liblapack.a –with-blacs=/pkg/blacs/lib/ –with-debugging=0 –download-scalapack=yes –download-mumps=yes  –download-netcdf=yse –download-ptscotch=yes –download-hypre=yes &>configure.log &

make PETSC_DIR=/tmp/liuxj_build/petsc-3.5.4 PETSC_ARCH=linux-openmpi-gcc all >& make.log &

make PETSC_DIR=/tmp/liuxj_build/petsc-3.5.4 PETSC_ARCH=linux-openmpi-gcc install  >&makinstall.log &

TIPS:

(1)Firstly,you must define the variables PETSC_DIR and PETSC_ARCH

(2)About the mpi, according your code to check if you need it . You can use the –with-mpi-dir=$MPI_DIR to replace  –with-cc or –with-fc and so on

(3) Some other libirary,such as blas ,lapack,netcdf,…..,you can use what you haved install in your system ;or you can use the similar arguments  –download-netcdf=yes to download it when you compile .

The above document  is just personal opinion. Maybe something is wrong .Please just reference.