From Documentation
Jump to: navigation, search
Note: This page hasn't been updated for a long time, and is most likely outdated.
If you need it to be updated, please submit a ticket to with the link to the page.


Nick Chepurniy, Ph.D.
HPC Consultant - SHARCNET
Compute Canada


The eigenvalues for the following simple boundary value problem (SBVP):

 - d^2 u/ d x^2 = lambda u

are computed using OCTAVE, FORTRAN (with LAPACK) and PETSc (with SLEPc).

All the required makefiles and submission scripts can be found in the tar file SBVP Example in C, F90, OCTAVE and PETSc

Different techniques are used to calculate the eigenvalues and they all produce the same set of eigenvalues. In the PETSC subdirectory a call to the c routine geta.c is made. This routine calculates the Chebyschev Differentiation matrix D and returns in the vector a the components of matrix -D2.

Another interesting technique is illustrated in subdirectory LAPACK. The main program generates the matrix A = -D2 and uses FORTRAN LAPACK routines to calculate the eigenvalues. A copy of matrix A is stored in AA which is then written to a binary c file using the c-routines cls.c opn.c wrt.c. Note that using the c-routines produces a much more compact binary file than if FORTRAN would have been used.

The binary PETSc file binary.3800 stores the elements of AA and there is also a header ASCII file fort.3800 with two lines: First line is a comment while the second line contains three integers: num_of_rows_in_AA num_of_cols_in_AA NNZ_in_AA (NNZ_in_AA = number of non-zero elements in AA stored in binary.3800).

In subdirectory B the binary c file binary.3800 is read in and the PETSc binary file bin3800.petsc is generated.

In subdirectory C the PETSc program loads the bin3800.petsc file and calculates the eigenvalues.

To save disk space soft links are generated in subdirectories B and C. The scripts DO_MAKE_LINKS and DO_REM_LINKS accomplish these tasks.

The HIST file in each subdirectory lists the commands to edit, compile and submit jobs in that subdirectory.

Last update: 12 Sept 2013