Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 4,168
    • Issues 4,168
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 18
    • Merge requests 18
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #23705
Closed
Open
Issue created Jul 06, 2022 by Eisuke Kawashima@e-kwsmContributor

FindLAPACK regression: fails with GNU compiler and `BLA_STATIC` of TRUE

Assume that:

  • Fortran compiler is GNU
  • generic BLAS/LAPACK libraries (netlib in this example) are available
  • BLA_VENDOR is not defined or set to All

With the following CMakeLists.txt:

cmake_minimum_required(VERSION 3.18)
project(MyProj LANGUAGES Fortran)
find_package(LAPACK REQUIRED)

CMake 3.21 or later works as expected if BLA_STATIC is OFF:

$ cmake -S . -B dynamic -D BLA_STATIC:BOOL=OFF
-- The Fortran compiler identification is GNU 10.2.1
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/f95 - skipped
-- Checking whether /usr/bin/f95 supports Fortran 90
-- Checking whether /usr/bin/f95 supports Fortran 90 - yes
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - not found
-- Looking for Fortran dgemm
-- Looking for Fortran dgemm - found
-- Found BLAS: /usr/lib/x86_64-linux-gnu/libblas.so;/usr/lib/x86_64-linux-gnu/libf77blas.so;/usr/lib/x86_64-linux-gnu/libatlas.so
-- Looking for Fortran cheev
-- Looking for Fortran cheev - not found
-- Looking for Fortran cheev
-- Looking for Fortran cheev - not found
-- Looking for Fortran cheev
-- Looking for Fortran cheev - found
-- Found LAPACK: /usr/lib/x86_64-linux-gnu/liblapack.so;/usr/lib/x86_64-linux-gnu/libblas.so;/usr/lib/x86_64-linux-gnu/libf77blas.so;/usr/lib/x86_64-linux-gnu/libatlas.so
-- Configuring done
-- Generating done
-- Build files have been written to: dynamic

but does not if ON:

$ cmake -S . -B static -D BLA_STATIC:BOOL=ON
-- The Fortran compiler identification is GNU 10.2.1
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/f95 - skipped
-- Checking whether /usr/bin/f95 supports Fortran 90
-- Checking whether /usr/bin/f95 supports Fortran 90 - yes
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - not found
-- Looking for Fortran dgemm
-- Looking for Fortran dgemm - found
-- Found BLAS: /usr/lib/x86_64-linux-gnu/libblas.a;/usr/lib/x86_64-linux-gnu/libf77blas.a;/usr/lib/x86_64-linux-gnu/libatlas.a
-- Looking for Fortran cheev
-- Looking for Fortran cheev - not found
-- Looking for Fortran cheev
-- Looking for Fortran cheev - not found
CMake Error at /usr/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find LAPACK (missing: LAPACK_LIBRARIES)
Call Stack (most recent call first):
  /usr/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.21/Modules/FindLAPACK.cmake:634 (find_package_handle_standard_args)
  CMakeLists.txt:3 (find_package)

-- Configuring incomplete, errors occurred!
See also "static/CMakeFiles/CMakeOutput.log".
See also "static/CMakeFiles/CMakeError.log".

gfortran a.o -fortanlibs returns 1 since the option is not supported; it must be specific to NVHPC/PGI compilers. This is a regression of 3.21 (!6089 (merged)).


If a user wants to link against NVHPC BLAS/LAPCK libraries by GCC, additional dependencies seem to be

  • static BLAS ($NVHPC_ROOT/compilers/lib/libblas.a):
    • $NVHPC_ROOT/compilers/lib/libnvc.a
  • dynamic BLAS ($NVHPC_ROOT/compilers/lib/libblas.so):
    • none
  • static LAPACK ($NVHPC_ROOT/compilers/lib/liblapack.a):
    • $NVHPC_ROOT/compilers/lib/libblas.a
    • $NVHPC_ROOT/compilers/lib/libnvc.a
  • dynamic LAPACK ($NVHPC_ROOT/compilers/lib/liblapack.so):
    • $NVHPC_ROOT/compilers/lib/libblas.so
    • $NVHPC_ROOT/compilers/lib/libnvf.so
    • -lrt

Here, BLAS/LAPACK libraries are symlinked to the LP64 correspondents.

Tested with:

  • GCC: 8.3.1
  • NVHPC: 22.1
Edited Jul 06, 2022 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking