How to Compile stetester

LAPACK (Wikipedia) provides numerically stable and fast implementations of linear algebra algorithms. In this post I will explain how to compile stetester, a testing infrastructure for LAPACK's symmetric eigensolvers.


For the following tasks BLAS and LAPACK must be installed on your computer. You will also need GNU Make, CMake, and a Fortran compiler, f.e., gfortran which is part of the GNU Compiler Collection. All of these programs should be available in the package manager of most Linux distributions. Moreover, I assume you are using Bash.

Compiling tmglib

Before we can compile stetester we have to compile and install LAPACK's test matrix generator library tmglib. tmglib is part of every LAPACK release which can be downloaded from the LAPACK website. Unpack the source code, change into the newly created directory. tmglib can be compiled with CMake or directly with GNU Make. If you want to compile with GNU Make, then you have to customize the file, save it as, and call make afterwards. Here, we will use CMake. Simply execute

cmake -Wno-dev .


After compling and linking with CMake(!), there should be three files in the subdirectory libs/:

  • libblas.a,
  • liblapack.a, and
  • libtmglib.a.

We can now compile stetester.

Compiling stetester

stetester is available as ACM algorithm 880 (paywalled text) from or Download the zip file, unzip it, copy the previously compiled file libtmglib.a into the newly created directory 880/, and change into this directory. In order to compile the code you have to provide a file called and several templates are available in the directory 880/INSTALL/. I wrote such a file for gfortran 4.2 and newer that links dynamically against the system BLAS and LAPACK libraries and is available here. Now type

make stetesterlib && make dstetester.x

These instructions build stetester for tests with double precision arithmetic. After compiling and linking there should be an executable called dstetester.x in the current directory. You can run stetester by feeding it instructions on standard input, f.e., try

./dstetester < INPUT/input.test.easy

The single precision executable can be built with

make stetesterlib && make sstetester.x

Closing Remarks

stetester can be used to test any implementation of LAPACK, f.e., Intel's MKL or AMD's ACML, by linking against the proper LAPACK library. If you used the file provided above, then LAPACK will be dynamically linked and you can simply change the environment variable LD_LIBRARY_PATH to switch implementations. With static libraries, you have to provide the path to the correct file in; the variable is called LAPACKLIB. Similarly, you can also change the BLAS implementation.