Skip to content

Commit c1def26

Browse files
authored
Merge branch 'develop' into remove-useless-scc
2 parents 1dba84c + 5a6f494 commit c1def26

File tree

1,108 files changed

+40429
-23746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,108 files changed

+40429
-23746
lines changed

.github/workflows/coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
uses: actions/checkout@v4
1616
- name: Install Requirements for Coverage Testing
1717
run: |
18-
apt update && apt install -y lcov
18+
apt update && apt install -y lcov gpg
1919
- name: Building
2020
run: |
21-
cmake -B build -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON -DBUILD_TESTING=ON -DENABLE_COVERAGE=ON
21+
cmake -B build -DENABLE_COVERAGE=ON -DBUILD_TESTING=ON -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_PAW=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON
2222
cmake --build build -j`nproc`
2323
cmake --install build
2424
- name: Testing

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
--from-ref ${{ github.event.pull_request.base.sha }}
4040
--to-ref ${{ github.event.pull_request.head.sha }}
4141
continue-on-error: true
42-
- uses: pre-commit-ci/[email protected].2
42+
- uses: pre-commit-ci/[email protected].3
4343

4444
- name: Build
4545
run: |

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ time.json
2323
__pycache__
2424
abacus.json
2525
*.npy
26-

CMakeLists.txt

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,6 @@ if(ENABLE_MPI)
238238
target_link_libraries(${ABACUS_BIN_NAME} MPI::MPI_CXX)
239239
add_compile_definitions(__MPI)
240240
list(APPEND math_libs MPI::MPI_CXX)
241-
else()
242-
find_package(MPI REQUIRED)
243-
include_directories(${MPI_CXX_INCLUDE_PATH})
244-
target_link_libraries(${ABACUS_BIN_NAME} MPI::MPI_CXX)
245-
list(APPEND math_libs MPI::MPI_CXX)
246241
endif()
247242

248243
find_package(Threads REQUIRED)
@@ -441,22 +436,6 @@ if(ENABLE_FLOAT_FFTW)
441436
endif()
442437

443438
if(ENABLE_DEEPKS)
444-
# Torch uses outdated components to detect CUDA arch, causing failure on
445-
# latest CUDA kits. Set CMake variable TORCH_CUDA_ARCH_LIST in the form of
446-
# "major.minor" if required.
447-
find_package(Torch REQUIRED)
448-
if(NOT Torch_VERSION VERSION_LESS "2.1.0")
449-
set_if_higher(CMAKE_CXX_STANDARD 17)
450-
elseif(NOT Torch_VERSION VERSION_LESS "1.5.0")
451-
set_if_higher(CMAKE_CXX_STANDARD 14)
452-
endif()
453-
include_directories(${TORCH_INCLUDE_DIRS})
454-
if(MKL_FOUND)
455-
list(PREPEND math_libs ${TORCH_LIBRARIES})
456-
else()
457-
list(APPEND math_libs ${TORCH_LIBRARIES})
458-
endif()
459-
add_compile_options(${TORCH_CXX_FLAGS})
460439
target_link_libraries(${ABACUS_BIN_NAME} deepks)
461440

462441
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
@@ -475,6 +454,25 @@ if(ENABLE_DEEPKS)
475454
add_compile_definitions(__DEEPKS)
476455
endif()
477456

457+
# Torch uses outdated components to detect CUDA arch, causing failure on
458+
# latest CUDA kits. Set CMake variable TORCH_CUDA_ARCH_LIST in the form of
459+
# "major.minor" if required.
460+
if(ENABLE_DEEPKS OR DEFINED Torch_DIR)
461+
find_package(Torch REQUIRED)
462+
if(NOT Torch_VERSION VERSION_LESS "2.1.0")
463+
set_if_higher(CMAKE_CXX_STANDARD 17)
464+
elseif(NOT Torch_VERSION VERSION_LESS "1.5.0")
465+
set_if_higher(CMAKE_CXX_STANDARD 14)
466+
endif()
467+
include_directories(${TORCH_INCLUDE_DIRS})
468+
if(MKL_FOUND)
469+
list(PREPEND math_libs ${TORCH_LIBRARIES})
470+
else()
471+
list(APPEND math_libs ${TORCH_LIBRARIES})
472+
endif()
473+
add_compile_options(${TORCH_CXX_FLAGS})
474+
endif()
475+
478476
if (ENABLE_CNPY)
479477
find_path(cnpy_SOURCE_DIR
480478
cnpy.h
@@ -492,7 +490,10 @@ if (ENABLE_CNPY)
492490
include_directories(${cnpy_INCLUDE_DIR})
493491
endif()
494492
include_directories(${cnpy_SOURCE_DIR})
495-
target_link_libraries(${ABACUS_BIN_NAME} cnpy)
493+
494+
# find ZLIB and link
495+
find_package(ZLIB REQUIRED)
496+
target_link_libraries(${ABACUS_BIN_NAME} cnpy ZLIB::ZLIB)
496497
add_compile_definitions(__USECNPY)
497498
endif()
498499

@@ -532,7 +533,7 @@ if(ENABLE_LIBRI)
532533
else()
533534
message(FATAL_ERROR "Must provide LIBRI_DIR for RI related features.")
534535
endif()
535-
target_link_libraries(${ABACUS_BIN_NAME} ri)
536+
target_link_libraries(${ABACUS_BIN_NAME} ri module_exx_symmetry)
536537
add_compile_definitions(__EXX EXX_DM=3 EXX_H_COMM=2 TEST_EXX_LCAO=0
537538
TEST_EXX_RADIAL=1)
538539
endif()
@@ -592,13 +593,14 @@ if(DEFINED DeePMD_DIR)
592593
add_compile_definitions(__DPMDC)
593594
else()
594595
target_link_libraries(${ABACUS_BIN_NAME} DeePMD::deepmd_cc)
595-
if(NOT DEFINED TensorFlow_DIR)
596-
set(TensorFlow_DIR ${DeePMD_DIR})
597-
endif()
598-
find_package(TensorFlow REQUIRED)
599-
if(TensorFlow_FOUND)
600-
target_link_libraries(${ABACUS_BIN_NAME} TensorFlow::tensorflow_cc)
601-
endif()
596+
endif()
597+
endif()
598+
599+
if(DEFINED TensorFlow_DIR)
600+
find_package(TensorFlow REQUIRED)
601+
include_directories(${TensorFlow_DIR}/include)
602+
if(TensorFlow_FOUND)
603+
target_link_libraries(${ABACUS_BIN_NAME} TensorFlow::tensorflow_cc)
602604
endif()
603605
endif()
604606

@@ -680,6 +682,7 @@ add_subdirectory(source)
680682
target_link_libraries(
681683
${ABACUS_BIN_NAME}
682684
base
685+
parameter
683686
cell
684687
symmetry
685688
md
@@ -702,7 +705,6 @@ target_link_libraries(
702705
psi_initializer
703706
esolver
704707
vdw
705-
parameter
706708
device
707709
container)
708710
if(ENABLE_LCAO)

Dockerfile.cuda

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
22

33
RUN apt update && apt install -y --no-install-recommends \
4-
libopenblas-openmp-dev liblapack-dev libscalapack-mpi-dev libelpa-dev libfftw3-dev libcereal-dev \
4+
libopenblas-openmp-dev liblapack-dev libscalapack-mpi-dev libfftw3-dev libcereal-dev \
55
libxc-dev libgtest-dev libgmock-dev libbenchmark-dev python3-numpy \
6-
bc cmake git g++ make bc time sudo unzip vim wget
6+
bc cmake git g++ make bc time sudo unzip vim wget libopenmpi-dev gfortran libtool-bin
77

88
ENV GIT_SSL_NO_VERIFY=true TERM=xterm-256color \
99
OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 \
@@ -13,6 +13,17 @@ RUN git clone https://github.com/llohse/libnpy.git && \
1313
cp libnpy/include/npy.hpp /usr/local/include && \
1414
rm -r libnpy
1515

16+
RUN cd /tmp && \
17+
ELPA_VER=2024.05.001 && \
18+
wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \
19+
tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \
20+
cd elpa-$ELPA_VER && \
21+
./configure CXX=mpic++ CFLAGS="-O3 -march=native" FCFLAGS="-O3" LDFLAGS="-L/usr/local/cuda/lib64 -lstdc++" NVCCFLAGS="-arch sm_75 -arch sm_80" --enable-openmp --enable-nvidia-gpu --with-NVIDIA-GPU-compute-capability="sm_70" --with-cuda-path=/usr/local/cuda/ && \
22+
make -j`nproc` && \
23+
make PREFIX=/usr/local install && \
24+
ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \
25+
cd /tmp && rm -rf elpa-$ELPA_VER
26+
1627
ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null
1728

1829
RUN git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \

deps/LibRI

Submodule LibRI updated 80 files

docs/advanced/acceleration/cuda.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ To compile and use ABACUS in CUDA mode, you currently need to have an NVIDIA GPU
2929

3030
Check the [Advanced Installation Options](https://abacus-rtd.readthedocs.io/en/latest/advanced/install.html#build-with-cuda-support) for the installation of CUDA version support.
3131

32+
Setting both USE_ELPA and USE_CUDA to ON does not automatically enable ELPA to run on GPUs. ELPA support for GPUs needs to be enabled when ELPA is compiled. [enable GPU support](https://github.com/marekandreas/elpa/blob/master/documentation/INSTALL.md).
33+
34+
The ABACUS program will automatically determine whether the current ELPA supports GPU based on the elpa/elpa_configured_options.h header file. Users can also check this header file to determine the GPU support of ELPA in their environment. ELPA introduced a new API elpa_setup_gpu in version 2023.11.001. So if you want to enable ELPA GPU in ABACUS, the ELPA version must be greater than or equal to 2023.11.001.
35+
3236
## Run with the GPU support by editing the INPUT script:
3337

3438
In `INPUT` file we need to set the input parameter [device](../input_files/input-main.md#device) to `gpu`. If this parameter is not set, ABACUS will try to determine if there are available GPUs.
35-
- Set `ks_solver`: For the PW basis, CG, BPCG and Davidson methods are supported on GPU; set the input parameter [ks_solver](../input_files/input-main.md#ks_solver) to `cg`, `bpcg` or `dav`. For the LCAO basis, `cusolver` is supported on GPU.
36-
- **multi-card**: ABACUS allows for multi-GPU acceleration. If you have multiple GPU cards, you can run ABACUS with several MPI processes, and each process will utilize one GPU card. For example, the command `mpirun -n 2 abacus` will by default launch two GPUs for computation. If you only have one card, this command will only start one GPU.
39+
- Set `ks_solver`: For the PW basis, CG, BPCG and Davidson methods are supported on GPU; set the input parameter [ks_solver](../input_files/input-main.md#ks_solver) to `cg`, `bpcg` or `dav`. For the LCAO basis, `cusolver`, `cusolvermp` and `elpa` is supported on GPU.
40+
- **multi-card**: ABACUS allows for multi-GPU acceleration. If you have multiple GPU cards, you can run ABACUS with several MPI processes, and each process will utilize one GPU card. For example, the command `mpirun -n 2 abacus` will by default launch two GPUs for computation. If you only have one card, this command will only start one GPU.
3741

3842
## Examples
3943
We provides [examples](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/gpu) of gpu calculations.
@@ -42,3 +46,6 @@ We provides [examples](https://github.com/deepmodeling/abacus-develop/tree/devel
4246
PW basis:
4347
- Only k point parallelization is supported, so the input keyword `kpar` will be set to match the number of MPI tasks automatically.
4448
- By default, CUDA architectures 60, 70, 75, 80, 86, and 89 are compiled (if supported). It can be overriden using the CMake variable [`CMAKE_CUDA_ARCHITECTURES`](https://cmake.org/cmake/help/latest/variable/CMAKE_CUDA_ARCHITECTURES.html) or the environmental variable [`CUDAARCHS`](https://cmake.org/cmake/help/latest/envvar/CUDAARCHS.html).
49+
LCAO basis:
50+
- Unless there is a specific reason, avoid using multiple GPUs, as it can be slower than using a single GPU. This is because the generalized eigenvalue solution of the LCAO basis set will incur additional communication overhead when calculated on multiple cards. When the memory limit of a GPU card makes it insufficient to complete the task, it is recommended to use multiple cards for calculation.
51+
- When using elpa on GPUs, some ELPA internal logs will be output.

docs/advanced/elec_properties/Berry_phase.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pseudo_dir ../../../tests/PP_ORB //the path to locate the pesudopotential
2323
orbital_dir ../../../tests/PP_ORB //the path to locate the numerical orbital files
2424
ntype 3
2525
ecutwfc 50 // Ry
26-
symmetry 0 // turn off symmetry
26+
symmetry -1 // turn off symmetry
2727
calculation nscf // non-self-consistent calculation
2828
basis_type lcao // atomic basis
2929
init_chg file // read charge from files
@@ -70,4 +70,6 @@ The results are shown as follows:
7070
P = 0.8906925 (mod 2.1748536) ( 0.0000000, 0.0000000, 0.8906925) C/m^2
7171
```
7272

73-
The electric polarization **P** is multivalued, which modulo a quantum e**R**/V~cell~. Note: the values in parentheses are the components of the **P** along the c axis in the x, y, z Cartesian coordinates when set gdir = 3 in INPUT file.
73+
The electric polarization **P** is multivalued, which modulo a quantum e**R**/V~cell~.
74+
75+
Note: The vectors R1, R2, and R3 refer to the three lattice vectors of the unit cell. When gdir=3, the calculated polarization is along the R3 direction. The three values in parentheses represent the re-projection of the polarization along the R3 direction onto the Cartesian coordinate system (i.e., the xyz coordinate system). To obtain the full polarization components in the Cartesian system, you need to calculate the polarization for R1, R2, and R3 separately, and then sum their respective x, y, and z components.

docs/advanced/elec_properties/charge.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ After finishing the calculation, the information of the charge density is stroed
1010
The SPIN${spin}_CHG.cube file looks like:
1111

1212
```
13-
Cubefile created from ABACUS SCF calculation
13+
STEP: 0 Cubefile created from ABACUS. Inner loop is z, followed by y and x
1414
2 (nspin) 0.914047 (fermi energy, in Ry)
1515
2 0.0 0.0 0.0
1616
27 0.222222 0 0
@@ -31,7 +31,7 @@ Cubefile created from ABACUS SCF calculation
3131
...
3232
```
3333

34-
The first line is a brief description.\
34+
The first line contains the current ion step.\
3535
The second line contains NSPIN and Fermi energy.\
3636
The following 4 lines are the informations of lattice, in order:\
3737
 total number of atoms, the coordinate of original point.\

0 commit comments

Comments
 (0)