# Math Libraries

- Engineering Scientific Subroutine Library: ESSL
- Parallel Engineering Scientific Subroutine Library: PESSL
- Additional References

## Linking the LAPACK Math Library

For full functionality of the LAPACK library you also need to link the blas library and/or the ESSL library.

module load lapack export OBJECT_MODE=64 xlf90_r -q64 -o prog.out -O3 -qsuffix=f=f90 -L$LAPACK_LIB -llapack -lblas prog.90 xlf90_r -q64 -o prog.out -O3 -qsuffix=f=f90 -L$LAPACK_LIB -llapack -lessl prog.f90

## Linking the ESSL Math Library

Please note that ESSL does not include the full suite of LAPACK routines, but it does include the majority. But linking the ESSL library to your code also automatically links all the highly optimized (by IBM) blas routines. To cover the full functionality of LAPACK, you also need to link LAPACK to your code. See example above.

xlf90_r -q64 -O3 -o prog.exe -O3 -lessl prog.f90

### ESSLSMP: For OpenMP and multi-threaded codes

xlf90_r -q64 -qsmp -o prog.exe -qsuffix=f=f90 -O3 -lesslsmp prog.f90

Note that -qsmp is needed for the compiler to recognize any directives that may exist in the esslsmp library as well as your program. Since automatic parallization is one of the default options with -qsmp, the compiler will also try to parallelize your code where possible. Use "-qsmp=noauto" to suppress auto-parallelization.

hydra% setenv OMP_NUM_THREADS num (also works) hydra% ./prog.exe

## Linking with the PESSL Math Library: For MPI parallel codes

mpxlf90_r -q64 -O prog.exe -O3 -qsuffix=f=f90 prog.f90 -lpesslsmp -lblacssmp

## Additional References

- Automatically Tuned Linear Algebra Software (ATLAS)
- See the links to Guide and Reference for IBM ESSL and PESSL in the References section
- See the Compiling & Running Programs section in the Hydra User Guide
- ESSL/PESSL Subroutines List
- ESSL/PESSL Subroutines Explained
- BLAS: Basic Linear Algebra Package
- BLACS: Basic Linear Algebra Communication Subprogram; used in conjunction with PESSL or ScaLapack.
- Numerical Recipes in Fortran