Compiling OpenBLAS 0.3.21 with OpenMP support using Intel oneAPI

Compiling OpenBLAS 0.3.21 with OpenMP support using Intel oneAPI

OpenBLAS is a CPU-level optimized replacement to BLAS/LAPACK. In most cases it can substitute BLAS and/or LAPACK in attempt to achieve higher productivity, which is the main goal of most HPC applications. The last release of OpenBLAS (that is 0.3.21) has some critical problem with configuring the compilation whenever USE_OPENMP=1 is passed to make, in case Intel oneAPI compilers are employed.

The problem is in the Makefile. At some point there the ifort compiler becomes invoked without passing the necessary OpenMP flags, which in turn breaks the linking process afterwards. It is possible to fix that problematic make configuration, but there is an easier way to complete the compilation without modifying the files included in the OpenBLAS distribution.


OpenBLAS distribution comes with CMake support. It is considered experimental, but nevertheless it seems to work quite properly in this particular case (compiling the code against OpenMP using Initel oneAPI):


cmake -B build-intel -DCMAKE_C_COMPILER=icc -DCMAKE_C_FLAGS="-static-intel" -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_Fortran_FLAGS="-static-intel" -DCMAKE_BUILD_TYPE=Release -DUSE_OPENMP=1 -DBUILD_SHARED_LIBS=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/path/to/the/install/folder


The -static-intel flag passed to the C and Fortran compilers is there in attempt to force compiler-rt libraries of Intel oneAPI to become part of the libopenblas.so binary code. Note that not all compiler-rt libraries could be linked statically.


The complete recipe used to compile and install OpenBLAS 0.3.21 in Discoverer HPC software repository is available on-line at:


https://gitlab.discoverer.bg/vkolev/recipes/-/tree/main/openblas

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Appliance - Powered by TurnKey Linux