LAPACK relies on BLAS to provide more complicated linear algebra routines for e.g. solving systems of linear equations and linear least squares, eigenvalue problems, or matrix factorizations such as LU.
Many different implementations of BLAS and LAPACK exist. A commonly used one is OpenBLAS, which contains both BLAS and LAPACK in one library file. I.e. if one uses OpenBLAS it suffices to add
-lopenblasto link in support for both BLAS and LAPACK functions.
In other implementations BLAS and LAPACK are in separate libraries and then one usually adds
-lblas -llapackto link in support for BLAS and LAPACK functions.
-lgsl -lgslcblasIn this form it uses the BLAS implementation gslcblas, provided by the GSL itself. However, since gslcblas is not optimized very well, it is better to use something like
-lgsl -lopenblasThen it uses the faster OpenBLAS library.
-lumfpack -lamd -lopenblasBoth UMFPACK and AMD are part of the very large SuiteSparse package. However, if you only need UMFPACK (and AMD) you can also just type
git clone https://github.com/wofti/Packages.git cd Packages/forUMFPACKand build it yourself by following the instructions in the Note.txt file, located in the forUMFPACK dir.
module load openblasbefore compiling. Then the -L and -I options do not need to be given, and configurations such as MyConfig simplify.
This works because the module system will do one of two things:
echo $LIBRARY_PATH echo $CPATHIf the module system sets LIBRARY_PATH and CPATH, it should also set the environment variable LD_LIBRARY_PATH. LD_LIBRARY_PATH is not directly used by the compiler. Rather it is used at program start to find and load all shared libraries that the program needs. Check it with:
echo $LD_LIBRARY_PATHIf only LD_LIBRARY_PATH is wrong, the compilation will succeed, but when you start the compiled program, you may get "error while loading shared libraries".
pkg-config --libs openblas pkg-config --cflags openblasshould tell us the locations for openblas. When pkg-config works on Athene, we can even use
SPECIALLIBS += $(shell pkg-config --libs openblas)directly in the MyConfig. But on Athene you never know if a module sets up the environment variables that pkg-config needs, so that pkg-config may fail as well.