Skip to content

Commit 34fe8dd

Browse files
Growl1234ZhouXY-PKU
authored andcommitted
CMake: Decouple ELPA dependency from LCAO
1 parent 0dca9dd commit 34fe8dd

5 files changed

Lines changed: 22 additions & 23 deletions

File tree

.github/workflows/build_test_cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
name: "Build without LCAO"
4242
- tag: gnu
4343
external_toolchain_args: ""
44-
build_args: "-DUSE_ELPA=OFF "
44+
build_args: "-DENABLE_ELPA=OFF "
4545
name: "Build without ELPA"
4646
- tag: gnu
4747
external_toolchain_args: ""

CMakeLists.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ option(ENABLE_RAPIDJSON "Enable rapid-json usage" OFF)
6565
option(ENABLE_CNPY "Enable cnpy usage" OFF)
6666

6767
# Options requiring MPI and LCAO
68-
cmake_dependent_option(ENABLE_ELPA "Enable ELPA for LCAO" ON "ENABLE_LCAO;ENABLE_MPI" OFF)
68+
cmake_dependent_option(ENABLE_ELPA "Enable ELPA eigensolver" ON "ENABLE_MPI" OFF)
6969
cmake_dependent_option(ENABLE_LIBRI "Enable LibRI for hybrid functional"
7070
OFF "ENABLE_LCAO;ENABLE_MPI" OFF)
7171
cmake_dependent_option(ENABLE_PEXSI "Enable PEXSI for LCAO" OFF "ENABLE_LCAO;ENABLE_MPI" OFF)
@@ -304,17 +304,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES Intel)
304304
set(ENABLE_ABACUS_LIBM OFF)
305305
endif()
306306

307-
if(ENABLE_LCAO)
308-
if(ENABLE_ELPA)
309-
find_package(ELPA REQUIRED)
310-
endif()
311-
if(ENABLE_PEXSI)
312-
find_package(PEXSI REQUIRED CONFIG)
313-
if(PEXSI_VERSION VERSION_LESS "2.0.0")
314-
message(FATAL_ERROR "PEXSI >= 2.0.0 is required")
315-
endif()
316-
set(CMAKE_CXX_STANDARD 14)
307+
if(ENABLE_ELPA)
308+
find_package(ELPA REQUIRED)
309+
endif()
310+
if(ENABLE_PEXSI)
311+
find_package(PEXSI REQUIRED CONFIG)
312+
if(PEXSI_VERSION VERSION_LESS "2.0.0")
313+
message(FATAL_ERROR "PEXSI >= 2.0.0 is required")
317314
endif()
315+
set(CMAKE_CXX_STANDARD 14)
318316
endif()
319317

320318
if(ENABLE_MPI)

cmake/CollectBuildInfoVars.cmake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,6 @@ else()
126126
set(ABACUS_LCAO_ENABLED "False")
127127
endif()
128128

129-
# Core Math Libraries
130-
if(ENABLE_LCAO AND ENABLE_ELPA)
131-
set(ABACUS_ELPA_VERSION "yes (v${ELPA_VERSION})")
132-
else()
133-
set(ABACUS_ELPA_VERSION "no")
134-
endif()
135-
136129
# BLAS and FFTW libraries
137130
if(MKL_FOUND)
138131
set(ABACUS_BLAS_VENDOR "MKL")
@@ -179,6 +172,13 @@ else()
179172
endif()
180173
endif()
181174

175+
# ELPA eigensolver
176+
if(ENABLE_ELPA)
177+
set(ABACUS_ELPA_VERSION "yes (v${ELPA_VERSION})")
178+
else()
179+
set(ABACUS_ELPA_VERSION "no")
180+
endif()
181+
182182
if(ENABLE_LIBXC AND Libxc_VERSION)
183183
set(ABACUS_LIBXC_VERSION "yes (v${Libxc_VERSION})")
184184
elseif(ENABLE_LIBXC)

source/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,10 @@ target_link_libraries(
687687
device
688688
base)
689689

690+
if(ENABLE_ELPA)
691+
target_link_libraries(${ABACUS_BIN_NAME} PRIVATE genelpa)
692+
endif()
693+
690694
if(ENABLE_LCAO)
691695
target_link_libraries(
692696
${ABACUS_BIN_NAME}
@@ -702,9 +706,6 @@ if(ENABLE_LCAO)
702706
if(ENABLE_LIBRI)
703707
target_link_libraries(${ABACUS_BIN_NAME} PRIVATE bse)
704708
endif()
705-
if(ENABLE_ELPA)
706-
target_link_libraries(${ABACUS_BIN_NAME} PRIVATE genelpa)
707-
endif()
708709
if(ENABLE_PEXSI)
709710
target_link_libraries(${ABACUS_BIN_NAME} PRIVATE pexsi)
710711
endif()

source/source_hsolver/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ if(ENABLE_COVERAGE)
8080
add_coverage(hsolver)
8181
endif()
8282

83-
if(ENABLE_LCAO AND ENABLE_ELPA)
83+
if(ENABLE_ELPA)
8484
add_subdirectory(module_genelpa)
8585
endif()
8686

0 commit comments

Comments
 (0)