Skip to content

Commit 15da1aa

Browse files
committed
CMake: Remove FindPEXSI.cmake
1 parent c43b14e commit 15da1aa

8 files changed

Lines changed: 14 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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,11 @@ if(ENABLE_LCAO)
321321
endif()
322322

323323
if(ENABLE_PEXSI)
324-
find_package(PEXSI REQUIRED)
324+
enable_language(C)
325+
find_package(PEXSI REQUIRED CONFIG)
326+
if(PEXSI_VERSION VERSION_LESS "2.0.0")
327+
message(FATAL_ERROR "PEXSI >= 2.0.0 is required")
328+
endif()
325329
abacus_add_feature_definitions(__PEXSI)
326330
set(CMAKE_CXX_STANDARD 14)
327331
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
@@ -198,16 +198,7 @@ if(ENABLE_LCAO)
198198
endif()
199199

200200
if(ENABLE_PEXSI)
201-
# Temporary adapter for the legacy FindPEXSI.cmake result. Replace this with
202-
# PEXSI::PEXSI when config-package discovery is adopted.
203-
list(APPEND _abacus_feature_libs
204-
${PEXSI_LIBRARY}
205-
${SuperLU_DIST_LIBRARY}
206-
${ParMETIS_LIBRARY}
207-
${METIS_LIBRARY})
208-
list(APPEND _abacus_feature_include_dirs
209-
${PEXSI_INCLUDE_DIR}
210-
${ParMETIS_INCLUDE_DIR})
201+
list(APPEND _abacus_feature_libs PEXSI::PEXSI)
211202
endif()
212203
endif()
213204

@@ -334,6 +325,7 @@ foreach(_abacus_feature_target IN ITEMS
334325
NEP::nep
335326
TensorFlow::tensorflow_cc
336327
ZLIB::ZLIB
328+
PEXSI::PEXSI
337329
NCCL::NCCL
338330
CAL::CAL
339331
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)