Skip to content

Commit f06e84c

Browse files
committed
CMake: Remove FindPEXSI.cmake
1 parent 52a15fc commit f06e84c

8 files changed

Lines changed: 15 additions & 90 deletions

File tree

.github/workflows/ase_plugin_test.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,8 @@ jobs:
4848
- name: Configure & Build ABACUS (GNU)
4949
run: |
5050
git config --global --add safe.directory `pwd`
51-
export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU_DIST32_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH}
52-
export PKG_CONFIG_PATH=${GKLIB_ROOT}/lib/pkgconfig:${METIS32_ROOT}/lib/pkgconfig:${PARMETIS32_ROOT}/lib/pkgconfig:${SUPERLU_DIST32_ROOT}/lib/pkgconfig:${PEXSI32_ROOT}/lib/pkgconfig:${PKG_CONFIG_PATH}
53-
export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU_DIST32_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH}
54-
export CMAKE_PREFIX_PATH=${PEXSI32_ROOT}:${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}:${CMAKE_PREFIX_PATH}
5551
source toolchain/install/setup
52+
prepend_path CMAKE_PREFIX_PATH ${PEXSI32_ROOT}:${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}
5653
rm -rf build
5754
cmake -B build -G Ninja
5855
cmake --build build -j2

.github/workflows/build_test_cmake.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,8 @@ jobs:
7070
- name: Build
7171
run: |
7272
git config --global --add safe.directory `pwd`
73-
export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU_DIST32_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH}
74-
export PKG_CONFIG_PATH=${GKLIB_ROOT}/lib/pkgconfig:${METIS32_ROOT}/lib/pkgconfig:${PARMETIS32_ROOT}/lib/pkgconfig:${SUPERLU_DIST32_ROOT}/lib/pkgconfig:${PEXSI32_ROOT}/lib/pkgconfig:${PKG_CONFIG_PATH}
75-
export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU_DIST32_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH}
76-
export CMAKE_PREFIX_PATH=${PEXSI32_ROOT}:${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}:${CMAKE_PREFIX_PATH}
7773
source toolchain/install/setup
74+
prepend_path CMAKE_PREFIX_PATH ${PEXSI32_ROOT}:${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}
7875
rm -rf build
7976
cmake -B build -G Ninja ${{ matrix.build_args }}
8077
cmake --build build -j $(nproc)

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,12 @@ if(ENABLE_LCAO)
323323
endif()
324324

325325
if(ENABLE_PEXSI)
326-
find_package(PEXSI REQUIRED)
326+
enable_language(C)
327+
enable_language(Fortran)
328+
find_package(PEXSI REQUIRED CONFIG)
329+
if(PEXSI_VERSION VERSION_LESS "2.0.0")
330+
message(FATAL_ERROR "PEXSI >= 2.0.0 is required")
331+
endif()
327332
abacus_add_feature_definitions(__PEXSI)
328333
set(CMAKE_CXX_STANDARD 14)
329334
endif()

cmake/CollectBuildInfoVars.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,7 @@ else()
370370
endif()
371371

372372
if(ENABLE_PEXSI)
373-
set(ABACUS_PEXSI_VERSION "yes (version unknown)")
374-
if(PEXSI_VERSION)
375373
set(ABACUS_PEXSI_VERSION "yes (v${PEXSI_VERSION})")
376-
elseif(PEXSI_DIR)
377-
set(ABACUS_PEXSI_VERSION "yes (path: ${PEXSI_DIR})")
378-
endif()
379374
else()
380375
set(ABACUS_PEXSI_VERSION "no")
381376
endif()

cmake/modules/FindPEXSI.cmake

Lines changed: 0 additions & 57 deletions
This file was deleted.

docs/advanced/install.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,11 @@ cmake -B build -DUSE_ABACUS_LIBM=1
145145

146146
## Build with PEXSI support
147147

148-
ABACUS supports the PEXSI library for gamma only LCAO calculations. PEXSI version 2.0.0 is tested to work with ABACUS, please always use the latest version of PEXSI.
148+
ABACUS supports the PEXSI library for gamma only LCAO calculations. PEXSI version >=2.0.0 is required.
149149

150-
To build ABACUS with PEXSI support, you need to compile PEXSI (and its dependencies) first. Please refer to the [PEXSI Installation Guide](https://pexsi.readthedocs.io/en/latest/install.html) for more details. Note that PEXSI requires ParMETIS and SuperLU_DIST.
150+
To build ABACUS with PEXSI support, you need to compile PEXSI and its dependencies first. Please refer to the [PEXSI Installation Guide](https://pexsi.readthedocs.io/en/latest/install.html) for more details. You can also use [Spack](https://github.com/spack/spack) to install the required packages more easily. Note that PEXSI requires ParMETIS and SuperLU_DIST.
151151

152-
After compiling PEXSI, you can set `ENABLE_PEXSI` to `ON`. If the libraries are not installed in standard paths, you can set `PEXSI_DIR`, `ParMETIS_DIR` and `SuperLU_DIST_DIR` to the corresponding directories.
153-
154-
```bash
155-
cmake -B build -DENABLE_PEXSI=ON -DPEXSI_DIR=${path to PEXSI installation directory} -DParMETIS_DIR=${path to ParMETIS installation directory} -DSuperLU_DIST_DIR=${path to SuperLU_DIST installation directory}
156-
```
152+
After compiling PEXSI, pass `-DENABLE_PEXSI=ON` to CMake. ABACUS uses the CMake config package provided by PEXSI; if PEXSI or its dependencies are not installed in standard paths, add their installation prefixes to `CMAKE_PREFIX_PATH`.
157153

158154
## Build ABACUS with make
159155

source/CMakeLists.txt

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,7 @@ if(ENABLE_LCAO)
201201
endif()
202202

203203
if(ENABLE_PEXSI)
204-
# Temporary adapter for the legacy FindPEXSI.cmake result. Replace this with
205-
# PEXSI::PEXSI when config-package discovery is adopted.
206-
list(APPEND _abacus_feature_libs
207-
${PEXSI_LIBRARY}
208-
${SuperLU_DIST_LIBRARY}
209-
${ParMETIS_LIBRARY}
210-
${METIS_LIBRARY})
211-
list(APPEND _abacus_feature_include_dirs
212-
${PEXSI_INCLUDE_DIR}
213-
${ParMETIS_INCLUDE_DIR})
204+
list(APPEND _abacus_feature_libs PEXSI::PEXSI)
214205
endif()
215206
endif()
216207

@@ -337,6 +328,7 @@ foreach(_abacus_feature_target IN ITEMS
337328
NEP::nep
338329
TensorFlow::tensorflow_cc
339330
ZLIB::ZLIB
331+
PEXSI::PEXSI
340332
NCCL::NCCL
341333
CAL::CAL
342334
cusolverMp::cusolverMp

source/source_hsolver/test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ if (ENABLE_MPI)
102102
)
103103
endif()
104104

105-
if (ENABLE_PEXSI)
105+
if (TARGET PEXSI::PEXSI)
106106
AddTest(
107107
TARGET MODULE_HSOLVER_LCAO_PEXSI
108-
LIBS parameter ${PEXSI_LIBRARY} ${SuperLU_DIST_LIBRARY} ${ParMETIS_LIBRARY} ${METIS_LIBRARY} MPI::MPI_CXX base psi device pexsi
108+
LIBS parameter PEXSI::PEXSI base psi device pexsi
109109
SOURCES diago_pexsi_test.cpp ../diago_pexsi.cpp ../../source_basis/module_ao/parallel_orbitals.cpp
110110
)
111111
endif()

0 commit comments

Comments
 (0)