Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find_package error when building with openblas #4021

Closed
16 tasks
minyez opened this issue Apr 18, 2024 · 4 comments
Closed
16 tasks

find_package error when building with openblas #4021

minyez opened this issue Apr 18, 2024 · 4 comments
Assignees
Labels
Bugs Bugs that only solvable with sufficient knowledge of DFT

Comments

@minyez
Copy link

minyez commented Apr 18, 2024

Describe the bug

When building ABACUS on macOS using cmake (version 3.28.3), gcc, mpich, openblas and scalapack, find_package error is encountered when trying to find BLAS.

-- The CXX compiler identification is GNU 13.2.0
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/bin/g++-13 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.39.3 (Apple Git-146)")
-- Found git: attempting to get commit info...
-- Current commit hash: 29b4eedc5
-- Last commit date: Thu Apr 18 12:22:38 2024 +0200
-- Found Cereal: /opt/homebrew/Cellar/cereal/1.3.2/include/cereal
-- Found MPI_CXX: /opt/homebrew/Cellar/mpich/4.1.2/lib/libmpicxx.dylib (found version "4.0")
-- Found MPI: TRUE (found version "4.0")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND
-- Found FFTW3: /opt/packages/fftw/3.3.10/gcc-13.2.0-mpich-4.1.2/lib/libfftw3_omp.dylib
CMake Error at cmake/FindBLAS.cmake:8 (find_package):
  find_package maximum nesting depth of 500 exceeded.
Call Stack (most recent call first):
  cmake/FindBLAS.cmake:8 (find_package)
  cmake/FindBLAS.cmake:8 (find_package)
  cmake/FindBLAS.cmake:8 (find_package)
  cmake/FindBLAS.cmake:8 (find_package)
  cmake/FindBLAS.cmake:8 (find_package)
...
  cmake/FindBLAS.cmake:8 (find_package)
  cmake/FindBlas.cmake:8 (find_package)
  cmake/FindLapack.cmake:9 (find_package)
  CMakeLists.txt:398 (find_package)
...

Expected behavior

The configure process should terminate successfully.

To Reproduce

Clone the code and configure the build directory with the following script. Some path variables need to be adapted.

#!/usr/bin/env bash

BUILD_DIR=build

LAPACK="/opt/homebrew/Cellar/openblas/0.3.26/lib"
CEREAL="/opt/homebrew/Cellar/cereal/1.3.2/include/cereal"
# need to adapt following variables
SCALAPACK="/opt/packages/scalapack/2.2.0/gcc-13.2.0-mpich-4.1.2-openblas"
FFTW3="/opt/packages/fftw/3.3.10/gcc-13.2.0-mpich-4.1.2"
LIBXC="/opt/packages/libxc/6.2.2/gcc-13.2.0"

export MPICH_CXX="g++-13"

cmake -B $BUILD_DIR \
    -DCMAKE_CXX_COMPILER=g++-13 \
    -DMPI_CXX_COMPILER=mpicxx \
    -DBLAS_DIR="$LAPACK" \
    -DLAPACK_DIR="$LAPACK" \
    -DSCALAPACK_DIR="$SCALAPACK" \
    -DFFTW3_DIR="$FFTW3" \
    -DCEREAL_INCLUDE_DIR="$CEREAL" \
    -DLibxc_DIR="$LIBXC" \
    -DENABLE_LCAO=ON \
    -DENABLE_LIBXC=ON \
    -DUSE_OPENMP=ON \
    -DUSE_ELPA=OFF

Environment

  • OS: macOS Sonoma 14.2.1
  • Compiler: gcc 13.2.0 (homebrew)
  • MPI: mpich 4.1.2 (homebrew)
  • cmake: 3.28.3 (homebrew)
  • LAPACK: OpenBLAS 0.3.26 (homebrew)
  • ScaLAPACK: 2.2.0, built with gcc and openblas above
  • FFTW3: 3.3.10, built with gcc and mpich above

Additional Context

The error seems to be related to case sensitivity of find_package modules. The configure process goes smoothly if I

  • rename cmake/FindBlas.cmake to cmake/FindBlasWrap.cmake
  • rename cmake/FindLapack.cmake to cmake/FindLapackWrap.cmake and therein change find_package(Blas REQUIRED) to find_package(BlasWrap REQUIRED)
  • modify CMakeLists.txt to use find_package(LapackWrap REQUIRED)

I'm not sure if it is really a bug, or it is actually due to some mistake in my build script or recent change in cmake. Help would be greatly appreciated.

Task list for Issue attackers (only for developers)

  • Verify the issue is not a duplicate.
  • Describe the bug.
  • Steps to reproduce.
  • Expected behavior.
  • Error message.
  • Environment details.
  • Additional context.
  • Assign a priority level (low, medium, high, urgent).
  • Assign the issue to a team member.
  • Label the issue with relevant tags.
  • Identify possible related issues.
  • Create a unit test or automated test to reproduce the bug (if applicable).
  • Fix the bug.
  • Test the fix.
  • Update documentation (if necessary).
  • Close the issue and inform the reporter (if applicable).
@minyez minyez added the Bugs Bugs that only solvable with sufficient knowledge of DFT label Apr 18, 2024
@WHUweiqingzhou
Copy link
Collaborator

@caic99 could you have a look?

@caic99
Copy link
Member

caic99 commented Apr 22, 2024

Please see #3958

@minyez
Copy link
Author

minyez commented Apr 22, 2024

@caic99 Thank you for the reply. So this is an issue related to the case sensitivity of file system. IMHO, the question under #3757 is worth an answer. If abacus is not targeting case-insensitive file systems, it would be great to add a warning at the beginning of the build process or somewhere in the manual (apology if it is already there).

@caic99
Copy link
Member

caic99 commented Apr 22, 2024

@caic99 Thank you for the reply. So this is an issue related to the case sensitivity of file system. IMHO, the question under #3757 is worth an answer. If abacus is not targeting case-insensitive file systems, it would be great to add a warning at the beginning of the build process or somewhere in the manual (apology if it is already there).

Agreed. Let's discuss under the original issue.

@caic99 caic99 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugs Bugs that only solvable with sufficient knowledge of DFT
Projects
None yet
Development

No branches or pull requests

3 participants