I use GFortran on Fedora Linux 36, which uses OpenBLAS as the system BLAS/LAPACK library. When I add the -lblas -llapack flags to GFortran, does GFortran use OpenBLAS? If not, how can I use OpenBLAS with GFortran?
The OpenBLAS shared library would be named libopenblas.so
. Use -lopenblas
to link against it. Just the one flag is enough.
2 Likes
A far as I know OpenBLAS already includes its own implementation of LAPACk, unlike the BLAS implementation from netlib.org.
1 Like
But Iam not sure whether I remember correctly. Maybe there are also symbolic links involved.
In case of BLAS Level 2 and Level 3 routines, you can also try to experiment with the -fexternal-blas
and -fblas-matmul-limit
flags for gfortran
. These options are discussed in the thread: Mapping matrix & vector arithmetic to BLAS calls
How do I make OpenBLAS use all threads?
You could try setting one of these env vars
export OPENBLAS_NUM_THREADS=<N>
or
export OMP_NUM_THREADS=<N>