Linux,  openSUSE

Compiling PETSc on openSUSE 11.1

PETSc is a library for parallel computations that allows easy and transparent creation of both serial and parallel codes. It is based on BLAS, Lapack and MPI. To build the library on openSUSE 11.1, without relying on locally compiled BLAS, Lapack and MPI, but using the system libraries does require some additional settings, due to the missing configuration in the openmpi RPM’s.

The steps to compile a local, per-user version of PETSc are the following:

  • Add the Science repository to obtain the latest version of openmpi with the command (a previous version of openmpi is also available in the standard OSS repository, and the procedure to build PETSc against it is unchanged)
    • zypper ar Science
  • Install blas, lapack, openmpi and openmpi-devel with the following command, always in a root terminal:
    • zypper in blas lapack openmpi openmpi-devel
  • Extract the source code of PETS and put it in the final destination where you want it installed.
  • Open a user terminal in that location, and type:
    • export PETSC_DIR=$PWD
    • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/mpi/gcc/openmpi/lib64  (use lib instead than lib64 on a 32 bit platform)
    • export PATH=$PATH:/usr/lib64/mpi/gcc/openmpi/bin (use lib instead than lib64 on a 32 bit platform)
    • export PETSC_ARCH=linux-gnu-c-debug
  • Start the configuration process with the following command, and wait it completes:
    • ./config/ –with-cc=mpicc –with-fc=mpif90

    At the end of the process, if everything proceeded correctly, the script should show the compilation options and suggest to proceed with the compilation.

  • Compile PETSc with the command:
    • make all
  • If no error message is shown, a message that invites to test the build should be shown. To perform the tests, type
    • make test

If no error message is shown, the build process succeeded. To be able to use the library, it is still necessary to add the following lines to your ~/.bashrc file:

  • export PETSC_DIR=/path/to/your/petsc/directory
  • export PETSC_ARCH=linux-gnu-c-debug

with the appropriate path to the directory where PETSc has been installed.

Enjoy 😀

One Comment