{"id":182,"date":"2022-09-25T13:57:56","date_gmt":"2022-09-25T12:57:56","guid":{"rendered":"https:\/\/hpcwithus.discoverer.bg\/?p=182"},"modified":"2023-01-27T17:04:07","modified_gmt":"2023-01-27T17:04:07","slug":"compiling-openblas-0-3-21-with-openmp-support-using-intel-oneapi","status":"publish","type":"post","link":"https:\/\/hpcwithus.discoverer.bg\/?p=182","title":{"rendered":"Compiling OpenBLAS 0.3.21 with OpenMP support using Intel oneAPI"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><a href=\"https:\/\/github.com\/xianyi\/OpenBLAS\">OpenBLAS <\/a>is a CPU-level optimized replacement to <a href=\"https:\/\/netlib.org\/blas\/\">BLAS<\/a>\/<a href=\"https:\/\/netlib.org\/lapack\/\">LAPACK<\/a>. 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 <a href=\"https:\/\/github.com\/xianyi\/OpenBLAS\/releases\/tag\/v0.3.21\">0.3.21<\/a>) has some critical problem with configuring the compilation whenever <code>USE_OPENMP=1<\/code> is passed to <code>make<\/code>, in case <a href=\"https:\/\/www.intel.com\/content\/www\/us\/en\/developer\/tools\/oneapi\/overview.html\">Intel oneAPI<\/a> compilers are employed.<\/p>\n\n\n\n<p>The problem is in the <code>Makefile<\/code>. At some point there the <code>ifort<\/code> 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.<\/p>\n<\/blockquote>\n\n\n\n<br>\n\n\n\n<p>OpenBLAS distribution comes with <a href=\"http:\/\/cmake.org\">CMake <\/a>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):<\/p>\n\n\n\n<br>\n\n\n\n<p><code>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<\/code><\/p>\n\n\n\n<br>\n\n\n\n<p>The <code>-static-intel<\/code> 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 <code>libopenblas.so<\/code> binary code. Note that not all compiler-rt libraries could be linked statically.<\/p>\n\n\n\n<br>\n\n\n\n<p>The complete recipe used to compile and install OpenBLAS 0.3.21 in Discoverer HPC software repository is available on-line at:<\/p>\n\n\n\n<br>\n\n\n\n<p><a href=\"https:\/\/gitlab.discoverer.bg\/vkolev\/recipes\/-\/tree\/main\/openblas\">https:\/\/gitlab.discoverer.bg\/vkolev\/recipes\/-\/tree\/main\/openblas<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/hpcwithus.discoverer.bg\/?p=182\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"saved_in_kubio":false,"footnotes":""},"categories":[28],"tags":[45,48,16,46,47,18],"class_list":["post-182","post","type-post","status-publish","format-standard","hentry","category-compilers","tag-blas","tag-cmake","tag-intel-oneapi","tag-lapack","tag-openblas","tag-openmp"],"_links":{"self":[{"href":"https:\/\/hpcwithus.discoverer.bg\/index.php?rest_route=\/wp\/v2\/posts\/182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hpcwithus.discoverer.bg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hpcwithus.discoverer.bg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hpcwithus.discoverer.bg\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hpcwithus.discoverer.bg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=182"}],"version-history":[{"count":4,"href":"https:\/\/hpcwithus.discoverer.bg\/index.php?rest_route=\/wp\/v2\/posts\/182\/revisions"}],"predecessor-version":[{"id":207,"href":"https:\/\/hpcwithus.discoverer.bg\/index.php?rest_route=\/wp\/v2\/posts\/182\/revisions\/207"}],"wp:attachment":[{"href":"https:\/\/hpcwithus.discoverer.bg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hpcwithus.discoverer.bg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hpcwithus.discoverer.bg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}