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

[question] LAPACK and BLAS linking using modules/math_libs.cmake #273

Open
breengles opened this issue Jul 8, 2023 · 2 comments
Open

[question] LAPACK and BLAS linking using modules/math_libs.cmake #273

breengles opened this issue Jul 8, 2023 · 2 comments

Comments

@breengles
Copy link

breengles commented Jul 8, 2023

Hi!
I am trying to use the math_libs.cmake module to autodetect and link against LAPACK and BLAS. It seems like it found the correct paths to .so

-- Searching for BLAS using search order MKL;ESSL;OPENBLAS;ATLAS;ACML;SYSTEM_NATIVE
-- Setting -DHAVE_SYSTEM_NATIVE_BLAS
-- Found BLAS: SYSTEM_NATIVE (/usr/lib/x86_64-linux-gnu/libblas.so)
-- Searching for LAPACK using search order MKL;ESSL;OPENBLAS;ATLAS;ACML;SYSTEM_NATIVE
-- Setting -DHAVE_SYSTEM_NATIVE_LAPACK
-- Found LAPACK: SYSTEM_NATIVE (/usr/lib/x86_64-linux-gnu/liblapack.so)

and the same for ones installed via conda (mamba):

-- Searching for BLAS using search order MKL;ESSL;OPENBLAS;ATLAS;ACML;SYSTEM_NATIVE
-- Setting -DHAVE_SYSTEM_NATIVE_BLAS
-- Found BLAS: SYSTEM_NATIVE (/home/breengles/mambaforge/envs/adkb/lib/libblas.so)
-- Searching for LAPACK using search order MKL;ESSL;OPENBLAS;ATLAS;ACML;SYSTEM_NATIVE
-- Setting -DHAVE_SYSTEM_NATIVE_LAPACK
-- Found LAPACK: SYSTEM_NATIVE (/home/breengles/mambaforge/envs/adkb/lib/liblapack.so)

Unfortunately, I do not quite understand why this is not working as I get the following:
src/core.f90:228: undefined reference to 'dgemm_' and a couple of places more with other subroutines such as DSYGV, DSTEV, etc. Also, everything works just fine if I setup with ifort and mkl.
Can you point me, please, out to what I am missing here?

@breengles
Copy link
Author

well, adding the following to src/CMakeLists.txt

find_package(LAPACK)
target_link_libraries(${EXE} ${LAPACK_LIBRARIES})

solved the issue. Seems like I do not understand if autocmake should carry this on its own... perhaps, not.

@bast
Copy link
Member

bast commented Jul 14, 2023

Thanks for the question and sorry for the troubles. This summer I am going through refurbishing this code (while updating CMake code in a larger project) and I will answer as soon as I get again overview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants