Computational Cluster Programs

How to Use PETSc on ATS-Hosted Clusters

C Installation location: /u/local/apps/petsc/current-c

C++ Installation location: /u/local/apps/petsc/current-cxx

PETSc is a sophisticated set of software tools. If you are a new PETSc user, we recommend that you study PETSc documentation first. PETSc can be used in application codes written in C, C++, Fortran, MATLAB and Python.

Assume that you are using Intel-compiler-based OpenMPI from /u/local/intel/11.1/openmpi/1.4.4, e.g.
$ which mpicc
/u/local/intel/11.1/openmpi/1.4.4/bin/mpicc

To compile C code with PETSc, e.g. ex2.c type:

$ export PETSC_DIR=/u/local/apps/petsc/current-c
$ mpicc ex2.c -I$PETSC_DIR/include -L$PETSC_DIR/lib -lpetsc

To compile C++ code with PETSc,

$ export PETSC_DIR=/u/local/apps/petsc/current-cxx
$ mpicxx ex2.c -I$PETSC_DIR/include -L$PETSC_DIR/lib -lpetsc
Contact atshpc@ucla.edu if you have questions.