Skip to content

Commit

Permalink
fix: mkl scalapack linking (#4644)
Browse files Browse the repository at this point in the history
* fix: mkl scalapack linking

* fix testing

* Remove extra `endif`

* fix for libpaw tests

* patch for GNU env
  • Loading branch information
caic99 authored Jul 11, 2024
1 parent 41c3f5d commit 15e0b06
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,10 @@ if(MKLROOT)
find_package(MKL REQUIRED)
add_definitions(-D__MKL)
include_directories(${MKL_INCLUDE} ${MKL_INCLUDE}/fftw)
list(APPEND math_libs MKL::MKL MKL::MKL_SCALAPACK)
list(APPEND math_libs MKL::MKL)
if(TARGET MKL::MKL_SCALAPACK)
list(APPEND math_libs MKL::MKL_SCALAPACK)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES Intel)
list(APPEND math_libs ifcore)
endif()
Expand Down
7 changes: 6 additions & 1 deletion cmake/FindMKL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,9 @@ else()
mark_as_advanced(MKL_INCLUDE MKL_INTEL MKL_INTEL_THREAD MKL_CORE)
endif()

endif() # MKL::MKL
endif() # MKL::MKL

# For compatibility with legacy libpaw_interface CMakeLists.txt
if(TARGET MKL::MKL)
add_library(IntelMKL::MKL ALIAS MKL::MKL)
endif()
10 changes: 6 additions & 4 deletions source/module_base/test_parallel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
AddTest(
TARGET base_ParaCommon
LIBS MPI::MPI_CXX
LIBS MPI::MPI_CXX
SOURCES parallel_common_test.cpp ../global_variable.cpp ../parallel_common.cpp
)

AddTest(
TARGET base_ParaGlobal
LIBS MPI::MPI_CXX
LIBS MPI::MPI_CXX
SOURCES parallel_global_test.cpp ../global_variable.cpp ../parallel_global.cpp
)

Expand Down Expand Up @@ -37,7 +37,10 @@ add_test(NAME base_parallel_reduce_test
if(ENABLE_LCAO)
# figure out the lib that provides BLACS
if(MKLROOT)
set(BLACS_LIB IntelMKL::MKL)
list(APPEND BLACS_LIB MKL::MKL)
if(TARGET MKL::MKL_SCALAPACK)
list(APPEND BLACS_LIB MKL::MKL_SCALAPACK)
endif()
else()
set(BLACS_LIB ScaLAPACK::ScaLAPACK)
endif()
Expand All @@ -53,4 +56,3 @@ if(ENABLE_LCAO)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif()

0 comments on commit 15e0b06

Please sign in to comment.