petsc_test


petsc_test FORTRAN90 programs which demonstrates the use of the PETSc library.

PETSc is a library of high level mathematical routines that can be executed in a parallel environment, making it easier for a user to gain the advantages of MPI.

PETSc stands for the Portable Extensible Toolkit for Scientific Computations.

PETSc is particularly suitable for the numerical solution of systems of partial differential equations on high performance computers. PETSc includes parallel linear and nonlinear equation solvers and time integrators that may be used by application programs written in C, C++, FORTRAN77 or FORTRAN90.

PETSc consists of a number of libraries which work with a particular family of objects, such as vectors. Some of the PETSc modules deal with

PETSc includes parts of the following software libraries:

PETSC interacts with, complements, or supports a variety of programs including:

PETSc runs in parallel by relying on MPI, the message-passing

When PETSc is used by a FORTRAN90 program, each FORTRAN90 routine must add one or more include statements, so that the constants and functions are properly declared. Depending on the routines being used, there may be several include statements required. However, if a FORTRAN90 routine uses any PETSc routine or constant, it is always necessary to have at least the following:

      #include "include/finclude/petsc.h"
      

Usage:

Before using PETSc, the user must set the environment variable PETSC_DIR, indicating the full path of the PETSc home directory. On Phoenix, for instance, this might be done with the command

setenv PETSC_DIR /usr/local/petsc
This command might best be placed in the user's .cshrc file.

Before using PETSc, the user must set the environment variable PETSC_ARCH, indicating the architecture of the machine on which PETSc is to be run. On Phoenix, for instance, this might be done with the command

setenv PETSC_ARCH linux-gnu
This command might best be placed in the user's .cshrc file.

The commands required to compile, link and load a program with PETSc are complicated. It is best to use a makefile for this purpose, in which case most of the complications can be hidden. A bare bones makefile for the example ex1.c, which is going to use PETSc's Krylov Subspace Package (KSP), would look like this:

include ${PETSC_DIR}/bmake/common/base

ex1: ex1.o
        -${FLINKER} -o ex1 ex1.o ${PETSC_FORTRAN_LIB} ${PETSC_LIB}
      
To use this makefile, one simply types
make ex1
and the executable will be created.

The mpirun command may be used for small jobs that run for a short time on a few processors. Repeated use of the mpirun command for large long jobs is an abuse of the system and will not be allowed.

To run a program that uses PETSc, the user may invoke the mpirun command, specifying the number of processors.

mpirun -np 4 ex1
The mpirun command will automatically log the user into 3 more nodes of Phoenix, (requiring the user to type in a password each time!).

To run a program that uses PETSc, the CONDOR system is preferable. This is a batch system which tries to be fair and efficient in the allocation of computing resources. To use CONDOR, the user should create an executable program, then prepare a "CONDOR submit script" that describes how the executable is to be run, and on how many processors, and submit the script.

Languages:

petsc_test is available in a C++ version and a FORTRAN90 version.

Related Data and Programs:

BLACS is a FORTRAN90 example directory which illustrates how to use the Basic Linear Algebra Communication Subroutines for linear algebra computations on a distributed memory machine.

BLAS1 is a FORTRAN90 library containing vector-vector routines, and is included in PETSC.

BLAS2 is a FORTRAN90 library containing matrix-vector routines, and is included in PETSC.

BLAS3 is a FORTRAN90 library containing matrix-matrix routines, and is included in PETSC.

CONDOR, is a queueing system used locally to submit jobs to our parallel clusters.

LAPACK is a FORTRAN90 library which is an extensive linear algebra library, and is included in PETSC.

LINPACK is a FORTRAN90 library which is an extensive linear algebra library, and is included in PETSC.

MINPACK is a FORTRAN90 library which handles minimization and least squares, and is included in PETSC.

MPI is used as part of the PETSC library. You may be interested in seeing examples of that parallel programming system.

OPEN_MP is a directory of FORTRAN90 examples which illustrate the use of the OpenMP application program interface for carrying out parallel computations in a shared memory environment.

PESSL is a FORTRAN90 example directory which demonstrates the use of PESSL, the parallel mathematics library developed exclusively for use with IBM systems and compilers.

PETSc examples are also available in a C version, and a C++ version, and a FORTRAN77 version.

SPARSEKIT2 is a FORTRAN90 library of routines by Yousef Saad for sparse matrices, and is included in PETSC.

SPARSEPAK is a FORTRAN90 library of sparse matrix reordering routines, and is included in PETSC.

Reference:

  1. Edward Anderson, Zhaojun Bai, Christian Bischof, Susan Blackford, James Demmel, Jack Dongarra, Jeremy Du Croz, Anne Greenbaum, Sven Hammarling, Alan McKenney, Danny Sorensen,
    LAPACK User's Guide,
    Third Edition,
    SIAM, 1999,
    QA76.73.F25L36
  2. Satish Balay, Kris Buschelman, Victor Eijkhout, William Gropp, Dinesh Kaushik, Matt Knepley, Lois Curfman McInnes, Barry Smith, Hong Zhang,
    The PETSc Users Manual,
    ANL-95/11, Revision 2.3.0,
    Argonne National Laboratory;
    A copy is available in a PDF version.
  3. Jeff Borggaard,
    A PETSc Tutorial (in C);
    A copy is available in a PDF version.
  4. The PETSc website
    http://www.mcs.anl.gov

Examples and Tests:

MAKEFILE contains the information necessary to properly compile, link and load the various user examples. If you use PETSc, you will have to have a similar makefile. The makefile is used by typing commands like

make ex1
which compiles, links and loads the program ex1.F, creating the executable ex1, which may then be run by submitting a Condor job.

HELLO is the "Hello, world!" example.

EX5 is an example program supplied by the PETSc people. So far, I have been completely unable to use it. I cannot even get the first stage of processing going, that is, I cannot pass it through the C preprocessor. The symptom seems to be that the include files are not all in existence, are not in the right place, are misconfigured, and so on. I am giving up on the FORTRAN90 case, and retreating to C or C++, hoping for a better chance!

You can go up one level to the FORTRAN90 source codes.


Last revised on 17 January 2006.