Running Exp4


Exp4 is an exponential integrator developed by Marlis Hochbruck, Christian Lubich, and Hubert Selhofer and it can be found on the sofware page of the Numerical Analysis Group of the Universität Tübingen.  To download Exp4 click here.

In order for Exp4 to run LAPACK and BLAS libraries must be previously installed.  BLAS (Basic Linear Algebra Subprograms) is a package including routines that provide standard building blocks for performing basic vector and matrix operations.  LAPACK (Linear Algebra PACKage) includes routines for solving systems of simultaneous linear equations, least-squares solutions of linear systems of equations, eigenvalue problems, and singular value problems.


BLAS Installation

Given that the overall performance depends heavily on BLAS the use of optimized BLAS libraries is hightly recommended, in my case I used ATLAS (Automatically Tuned Linear Algebra Software) which provides you with a BLAS implementation Tuned to your system.

Comments on the ATLAS installation

ATLAS installation is very straight forward and the documentation is excellent.  The only problem I found occurred while running what they call the "sanity test", which basically makes sure that ATLAS implementation performs as expected.  The error I got was:
../uumtst.c: In function �ATL_U2GE�:
../uumtst.c:68: error: invalid storage class for function �ATL_L2GE�
../uumtst.c: At top level:
../uumtst.c:84: warning: conflicting types for �ATL_L2GE�
../uumtst.c:84: error: static declaration of �ATL_L2GE� follows
non-static declaration
../uumtst.c:70: error: previous implicit declaration of �ATL_L2GE� was here
make[3]: *** [suumtst.o] Error 1
make[3]: Leaving directory `/usr/local/src/ATLAS/bin/Linux_HAMMER64SSE3'
make[2]: *** [sanity_test] Error 2
make[2]: Leaving directory `/usr/local/src/ATLAS/bin/Linux_HAMMER64SSE3'
make[1]: *** [sanity_test] Error 2
make[1]: Leaving directory `/usr/local/src/ATLAS'
make: *** [sanity_test] Error 2

And its fixed by editing the file "ATLAS/bin/uumtst.c" and changing the location of the declaration beginning with "static ATL_L2GE" in the following manner:
ATLAS/bin/uumtst.c
...
#define test_lauum(Maj_, Uplo_, N_, A_, lda_) \
ATL_lauum(Maj_, Uplo_, N_, A_, lda_)
#endif
+ static void ATL_L2GE(const enum CBLAS_ORDER, const int, const TYPE*,
+ const int, TYPE*, const int);

static void ATL_U2GE
(const enum CBLAS_ORDER Order, const int N, const TYPE *U, const int
ldu,
TYPE *C, const int ldc)
{
int j;
- static void ATL_L2GE(const enum CBLAS_ORDER, const int, const TYPE*,
- const int, TYPE*, const int);


if (Order == CblasRowMajor) ATL_L2GE(CblasColMajor, N, U, ldu, C, ldc);
else
...
Where "+"  means add and "-" erase.

Installation on a Sun - Sparc Architecture:

This is a fragment of the ATLAS errata which concerns this kind of architectures:

There is an error in the cleanup code for the UltraSPARC processors, that can cause segmentation faults when [d,z]GEMM is called with K mod NB = 8. To fix, change line 275 of "ATLAS/tune/blas/gemm/CASES/ATL_dmm4x4x8_US.c" from

#if (KB != 2)
to:
#if (KB != 8)

before installation. If you have already installed, make the change, and then issue the following commands (substituting your arch string for ARCH, and giving full path where indicated):
 cd ATLAS/tune/blas/gemm/ARCH
rm [d,z]install
make dinstall
make zinstall
cd ATLAS/bin/ARCH
make dmmlib zmmlib dl3lib zl3lib

When using the architectural defaults for gcc/USIII, we need to add additional compiler flags for gcc installs that don't have them on by default. Change line 8 of the two files "ATLAS/tune/blas/gemm/CASES/[s,c]cases.flg" from:
-O -fomit-frame-pointer -fno-schedule-insns -fno-schedule-insns2
to:
-mcpu=ultrasparc -mtune=ultrasparc -O -fomit-frame-pointer -fno-schedule-insns -fno-schedule-insns2


Comments on ATLAS use

The only thing to remember is that in order to link the atlas libraries the next flag should be used IN THIS ORDER:

-L/Your_ATLAS_Lib_Path/ -llapack -lcblas -lf77blas -latlas

for uniprocessor libs and

-L/Your_ATLAS_Lib_Path/ -llapack -lptcblas -lptf77blas -latlas

for the SMP (Posix threads support enabled) version.


LAPACK Installation

Comments on the LAPACK installation

As oposed to ATLAS, LAPACK documentation is not very clear and is even confusing in many ways (at least for someone of my unix installation knowledge).   LAPACK can be downloaded here.

The main part of the LAPACK installation consists on the modification of a file called "make.inc", templates can be found in the directory "/LAPACK/INSTALL"  for different machine architechtures.

The make.inc I used is:

####################################################################
#  LAPACK make include file.                                       #
#  LAPACK, Version 3.0                                             #
#  June 30, 1999                                                   #
####################################################################
#
SHELL = /bin/sh
#
#  The machine (platform) identifier to append to the library names
#
PLAT = _Lin_Fil

#  Modify the FORTRAN and OPTS definitions to refer to the
#  compiler and desired compiler options for your machine.  NOOPT
#  refers to the compiler options desired when NO OPTIMIZATION is
#  selected.  Define LOADER and LOADOPTS to refer to the loader and
#  desired load options for your machine.
#
FORTRAN  = g77
OPTS     = -funroll-all-loops -O3
DRVOPTS  = $(OPTS)
NOOPT    =
LOADER   = g77
LOADOPTS =
#
#  The archiver and the flag(s) to use when building archive (library)
#  If you system has no ranlib, set RANLIB = echo.
#
ARCH     = ar
ARCHFLAGS= cr
RANLIB   = ranlib
#
#  The location of the libraries to which you will link.  (The
#  machine-specific, optimized BLAS library should be used whenever
#  possible.)
#
#BLASLIB      = ../../blas$(PLAT).a
BLASLIB      = -L/disk/data/munoz/ATLAS/lib/Lin_Fil/ -lf77blas -latlas
LAPACKLIB    = lapack$(PLAT).a
TMGLIB       = tmglib$(PLAT).a
EIGSRCLIB    = eigsrc$(PLAT).a
LINSRCLIB    = linsrc$(PLAT).a

########################################################

Which is basically the Linux template (after the patch has been applied) with the modifications I marked on green (name of the architecture and BLAS libraries location).

Apart from that the Makefile must be modified too but only if you are including optimized BLAS libraries and want LAPACK to use them instead of generating its own BLAS libraries.  For this is only needed to remove from the lib line the comand blaslib so that it becomes:

lib: lapacklib tmglib

Once the installation is done there is no sign telling you that everything went fine (which would be nice), but if no errors came out and nothing bad happened it means that everything worked fine, if you feel that you need the output saying everything went fine then take a look on the "/LAPACK/TESTING" folder in which files with the extension ".out" can be found with the reports.

IMPORTANT NOTE: For some time I was had a problem because the installation will hang during one of the tests, sadly I'm not entirely sure what helped me fix it.  Probably it was my lack of experience, but the things that I did to fix it were:  

- Rebuild the ATLAS libraries including the "ranlib" command.
- ERASING the previous LAPACK compilation using the comand "make clean" (I have the feeling this is all I needed to do).
- Rebuilding LAPACK again.

Once the installation is done the LAPACK libraries are included in the file "lapack_ARCH.a" where _ARCH is the architecture name chosen in the file "make.inc".

Finally as mentioned in the ATLAS documentation to obtain a LAPACK library that fully uses the ATLAS optimization the following steps should be followed starting on the folder where your ATLAS libraries are located (i.e. on the folder "ATLAS/lib/ARCH" where ARCH is the architecture name chosen in the ATLAS installation):

mkdir tmp
cd tmp
ar x ../liblapack.a
cp <your LAPACK path & lib> ../liblapack.a
ar r ../liblapack.a *.o
cd ..
rm -rf tmp


"<your LAPACK path & lib>" probably ends in "/LAPACK/lapack_ARCH.a" where _ARCH is the architecture name chosen in the file "make.inc".

Once this is done your LAPACK library will be on "ATLAS/lib/ARCH/liblapack.a" where ARCH is the architecture name chosen in the ATLAS installation.

IMPORTANT NOTE: In case of a problem difficult to solve there is an amazing forum in which a very helpful person that knows a lot answers questions promptly.

Click here to go to the LAPACK amazing forum.


Running Exp4

Since the examples are the best templates for functions that will be used as input for Exp4 and their Makefile the way to run Exp4 the first thing to do is to modify the Makefile to include the locations of the BLAS and LAPACK libraries, the modifications I made on it are:

For the BLAS libraries:
BLASLIB      = -L/disk/data/munoz/ATLAS/lib/Lin_Fil/ -llapack -lcblas -lf77blas -latlas

For the LAPACK libraries:
LAPACKLIB       = -L/disk/data/munoz/ATLAS/lib/Lin_Fil/ -llapack

Comments on Exp4 use:

As mentioned on the readme files the first thing one should do is to run the examples, while running the examples I got the error:

laser.c: In function @main@:
laser.c:207: warning: incompatible implicit declaration of built-in function @exit@
laser.c:207: error: too few arguments to function @exit@
make: *** [laser.o] Error 1
Exit 2

 
which I fixed just by editing the file "laser.c" on line 207 including an integer (1) as the argument of the function "exit()".

Installing Exp4 on a SunOS UltraSPARC III (Earth)

Installing everything on Earth proved to be quite a challenge, I succeeded installing BLAS but failed installing LAPACK using the Sun's compiler f77.  Here is the thread I created on the wonderful LAPACK forum with the purpose of solving the problem, in the end I was pointed that there actually is an implementation of both BLAS and LAPACK and so I decided to give it a try and it worked.  All that needs to be done is to include as BLAS and LAPACK libraries:

For the BLAS libraries:
BLASLIB      = -xlic_lib=sunperf

For the LAPACK libraries:
LAPACKLIB       = 
-xlic_lib=sunperf

Another problem I faced was that when I ran 
Make there would be a conflict between a suffix rule and the built-in rules that come by default on Make, the offending rule, which is located under the folder "/exp4/", was:

.c.o::        $(MAKEFILE)
              $(CC) -c $(CFLAGS) $(DEFINES) -o $@ $<
 
 
After trying unsuccesfully of  changing this rule into a pattern rule of the form "%.c :: %.o", I realized that the problem was not with the suffix rule but with the double-colon "::", after realizing this all I had to do was to change  all double-colons between the  targets and the prerequisites for a colon ":" and it worked fine, the makefile that I finally used is:

/exp4/Makefile

Uploaded in the 2nd of March of 2007


Files Download:

Finally here are all installation files metioned previously in case one of the package mainpages is down:

- ATLAS 3.6.0
- LAPACK 3.1.0
- Exp4 for C

All files where uploaded on the 16th of February of 2007.


Home
Research

Updated on the 2nd of March of 2007