apt – How to build and link BLAS and LAPACK libraries by hand for use on cluster?


I am making use of a partial pivoting function by the name of gesv. To get the libraries to make this happen in C++ I used a one line command from Installing BLAS and LAPACK packages.

sudo apt-get install libblas-dev liblapack-dev

Then I was able to link the libraries by adding the following to the compile instructions

g++ main.cpp -llapack -lblas

I got tremendous speed up on my laptop (Linux 2020), but when I started running on a cluster the method is extremely slow when running the same (large) case. I don’t think both of the libraries are installed on the cluster. The code runs, so it seems like whichever one provides the speed increase is not on the cluster I am using.

Is it possible to build and then link the lapack and blas libraries by “hand” rather than doing the apt-get command?

Thank you for your time.