I have downloaded and unzipped PETSc from PETSc Website in my home directory (OS is CentOS 6.3 64bit ) and followed given commands on Installation page "./configure --with-cc=gcc --with-fc=gfortran --download-f-blas-lapack --download-mpich" and "make all test". There was no error throughout the process. Is it installed properly? How should I start using these libraries in C programs? Is it possible to install it in "file system"? so that one can access it like "LAPACK" libraries or "CGNS" libraries.
1 Answer
If "make test" reports something like
Running test examples to verify correct installation
Using PETSC_DIR=/home/nate/src/PETSc-3.3 and PETSC_ARCH=arch-linux2-c-opt
C/C++ example src/snes/examples/tutorials/ex19 run successfully with 1 MPI process
C/C++ example src/snes/examples/tutorials/ex19 run successfully with 2 MPI processes
Fortran example src/snes/examples/tutorials/ex5f run successfully with 1 MPI process
Completed test examples
then indeed the library should be installed properly. I would recommend that you export the values of PETSC_DIR and PETSC_ARCH (the ones that, for example, are shown when you run the tests) in your .bashrc file such that they are always set. With these environment variables set, you can use PETSc from anywhere if you use makefiles which look something like:
MyCode: MyCode.o chkopts
${CLINKER} -o $@ $< ${PETSC_LIB}
include ${PETSC_DIR}/conf/variables
include ${PETSC_DIR}/conf/rules
If you need to make PETSc available for all users on your machine (like in /opt) then just go to the PETSc installation page and look for the section labeled:
Installing PETSc in /usr/local or /opt where sudo or root previledges are required