OpenBLAS - shawfdong/hyades GitHub Wiki
OpenBLAS is an optimized BLAS library based on GotoBLAS2. GotoBLAS, GotoBLAS2 and OpenBLAS are related implementations of the BLAS API with many hand-crafted optimizations for specific processor types. GotoBLAS was originally developed by Kazushige Goto (後藤和茂) at the Texas Advanced Computing Center; but is no longer under active development by TACC, with a final version touting optimal performance on Intel's Nehalem architecture (contemporary in 2008).
OpenBLAS is a continuation of GotoBLAS development. It adds optimized implementations of linear algebra kernels for several processor architectures, including Intel Sandy Bridge, which is the processor of choice for the Hyades cluster. It claims to achieve performance comparable to the Intel MKL.
Download the latest release tar ball from the official site and unpack it.
The stock GCC provided by RHEL/CentOS 6 is version 4.6.4, which appears to have AVX instruction set support[1]. OpenBLAS FAQ, however, recommends using gcc version 4.6 or above to compile Sandy Bridge AVX kernels[2]. So we'll use GCC 4.9.2.
Load module gcc/4.9.2.
$ module load gcc
Compile OpenBLAS 0.2.13:
$ make USE_THREAD=0 OpenBLAS build complete. (BLAS CBLAS LAPACK LAPACKE) OS ... Linux Architecture ... x86_64 BINARY ... 64bit C compiler ... GCC (command line : gcc) Fortran compiler ... GFORTRAN (command line : gfortran) Library Name ... libopenblas_sandybridge-r0.2.13.a (Single threaded)
Note:
- OpenBLAS can be compiled sequentially, or using the normal threading model (pthread pool, which is the default), or using OpenMP.
- Here we build a serial library(USE_THREAD=0).
- To compile a threaded version using OpenMP, replace USE_THREAD=0 with USE_OPENMP=1.
- This step will produce libopenblas.a (a symbolic link to libopenblas_sandybridgep-r0.2.13.a.
- The library contain object codes for all routines in BLAS, CBLAS (C interface to BLAS), LAPACK, and LAPACKE (C interface to LAPACK).
$ make PREFIX=/pfs/sw/serial/gcc/openblas-0.2.13 install
OpenBLAS 0.2.13 is installed at /pfs/sw/serial/gcc/openblas-0.2.13. To facilitate the usage of OpenBLAS, I've created a module lapack/s_gcc_OpenBLAS_0.2.13 to set up its environment. If you load the module, you can use more concise commands to link with the OpenBLAS library.
Load the OpenBLAS module:
$ module load lapack/s_gcc_OpenBLAS_0.2.13
To compile a Fortran program and link with OpenBLAS, using gfortran:
$ gfortran -o lapackpgm.x lapackpgm.f -lopenblas
To compile a Fortran program and link with OpenBLAS, using the Intel Fortran Compiler:
$ ifort -o lapackpgm.x lapackpgm.f -lopenblas -lgfortran
To compile a C program and link with OpenBLAS, using gcc:
$ gcc -o lapackepgm.x lapackepgm.f -lopenblas
To compile a C program and link with OpenBLAS, using the Intel C Compiler:
$ icc -o lapackepgm.x lapackepgm.f -lopenblas