Skip to content

Commit a3c0008

Browse files
authored
Merge pull request #152 from deepmodeling/develop
Merge deepmodeling develop up to v2.2.4
2 parents d494b6d + 654cea9 commit a3c0008

File tree

491 files changed

+14154
-15495
lines changed

Some content is hidden

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

491 files changed

+14154
-15495
lines changed

.github/workflows/cuda.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,31 @@ jobs:
4242
run: |
4343
nvidia-smi
4444
cmake -B build -DUSE_CUSOLVER_LCAO=ON
45-
cmake --build build -j4
45+
cmake --build build -j4
4646
cmake --install build
47-
- name: Test
47+
cmake -B build -DBUILD_TESTING=ON
48+
cmake --build build -j4 --target hsolver_diago
49+
- name: Test e2e
4850
run: |
4951
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64
5052
cd tests/integrate
5153
echo "ks_solver cusolver" >> ./270_NO_MD_2O/INPUT
52-
./Autotest.sh -r 270_NO_MD_2O
54+
./Autotest.sh -r 270_NO_MD_2O
55+
- name: Test UT
56+
run: |
57+
cd source/src_pdiag/test/
58+
cp ../../../build/source/src_pdiag/test/hsolver_diago .
59+
./hsolver_diago
60+
bash diago_parallel_test.sh
61+
- name: Test performance
62+
run: |
63+
cd examples/performance
64+
ls -d P1*lcao* > allcase
65+
sed -i '/ks_solver/d' P1*lcao*/INPUT
66+
sed -i '$a ks_solver cusolver' P1*lcao*/INPUT
67+
bash run.sh
68+
cat sumall.dat
69+
5370
5471
stop-runner:
5572
name: Stop self-hosted EC2 runner

.github/workflows/image.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Build Image
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches:
6-
- develop
7-
6+
tags:
7+
- 'v*'
88
jobs:
99
build_container_and_push:
1010
runs-on: ubuntu-latest
@@ -13,6 +13,15 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v3
1515

16+
- name: Docker meta
17+
id: meta
18+
uses: docker/metadata-action@v4
19+
with:
20+
images: |
21+
ghcr.io/${{ github.repository_owner }}
22+
${{ secrets.DP_HARBOR_REGISTRY }}/dplc
23+
tags: type=semver,pattern={{version}}
24+
1625
- name: Setup Docker Buildx
1726
uses: docker/setup-buildx-action@v1
1827

@@ -33,10 +42,6 @@ jobs:
3342
- name: Build and Push Container
3443
uses: docker/build-push-action@v2
3544
with:
36-
tags: |
37-
ghcr.io/${{ github.repository_owner }}/abacus:latest
38-
${{ secrets.DP_HARBOR_REGISTRY }}/dplc/abacus:latest
45+
tags: ${{ steps.meta.outputs.tags }}
3946
file: Dockerfile
40-
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/abacus:latest
41-
cache-to: type=inline
42-
push: true
47+
push: ${{ github.event_name == 'push' }}

.github/workflows/performance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
cmake --install build
2727
- name: Test
2828
run: |
29-
. /opt/intel/oneapi/setvars.sh 2> /dev/null || :
29+
test -e /opt/intel/oneapi/setvars.sh && . /opt/intel/oneapi/setvars.sh
3030
cd examples/performance/
3131
bash run.sh
3232
- name: Show Result

CMakeLists.txt

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.16)
55
########################################
66

77
project(ABACUS
8-
VERSION 2.2.0
8+
VERSION 2.2.3
99
DESCRIPTION "ABACUS is an electronic structure package based on DFT."
1010
HOMEPAGE_URL "https://github.com/deepmodeling/abacus-develop"
1111
LANGUAGES CXX
@@ -28,8 +28,10 @@ set(ABACUS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)
2828
set(ABACUS_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR}/${ABACUS_BIN_NAME})
2929
include_directories(${ABACUS_SOURCE_DIR})
3030
add_executable(${ABACUS_BIN_NAME} source/main.cpp)
31+
set(CMAKE_CXX_STANDARD 11)
32+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3133
add_compile_options(-O2 -g)
32-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings" )
34+
add_compile_options(-Wno-write-strings)
3335

3436
find_package(Cereal REQUIRED)
3537
include_directories(${Cereal_INCLUDE_DIR})
@@ -52,10 +54,9 @@ if(USE_OPENMP)
5254
find_package(OpenMP REQUIRED)
5355
target_link_libraries(${ABACUS_BIN_NAME} OpenMP::OpenMP_CXX)
5456
add_compile_options(${OpenMP_CXX_FLAGS})
55-
#add_compile_definitions(_OPENMP)
57+
add_link_options(${OpenMP_CXX_LIBRARIES})
5658
endif()
5759

58-
set(CMAKE_CXX_STANDARD 11)
5960
include(CheckLanguage)
6061
check_language(CUDA)
6162
if(CMAKE_CUDA_COMPILER)
@@ -71,7 +72,7 @@ if(CMAKE_CUDA_COMPILER)
7172
endif()
7273
else()
7374
if(NOT USE_CUDA AND NOT USE_CUSOLVER_LCAO)
74-
message(WARNING "CUDA components detected, but both USE_CUDA and USE_CUSOLVER_LCAO set to OFF. \nNOT building CUDA version of ABACUS.")
75+
message(STATUS "CUDA components detected, but both USE_CUDA and USE_CUSOLVER_LCAO set to OFF. NOT building CUDA version of ABACUS.")
7576
elseif (USE_CUDA AND USE_CUSOLVER_LCAO)
7677
message(FATAL_ERROR "USE_CUDA and USE_CUSOLVER_LCAO set, but now they not allowed to coexist.")
7778
endif()
@@ -88,8 +89,7 @@ if(USE_CUDA OR USE_CUSOLVER_LCAO)
8889
cmake_minimum_required(VERSION 3.18) # required by `CUDA_ARCHITECTURES` below
8990
set(CMAKE_CXX_STANDARD 14)
9091
set(CMAKE_CXX_EXTENSIONS ON)
91-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
92-
set(CMAKE_CUDA_STANDARD 14)
92+
set(CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})
9393
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
9494
set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER})
9595
enable_language(CUDA)
@@ -120,9 +120,7 @@ endif()
120120
# Warning: CMake add support to HIP in version 3.21. This is rather a new version.
121121
# Use cmake with AMD-ROCm: https://rocmdocs.amd.com/en/latest/Installation_Guide/Using-CMake-with-AMD-ROCm.html
122122
if(USE_ROCM)
123-
set(CMAKE_CXX_STANDARD 11)
124-
SET(CMAKE_HIP_STANDARD 11)
125-
# set(CMAKE_CXX_STANDARD_REQUIRED True)
123+
SET(CMAKE_HIP_STANDARD ${CMAKE_CXX_STANDARD})
126124
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
127125
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "/opt/rocm/hip")
128126

@@ -145,6 +143,9 @@ if(USE_ROCM)
145143
endif()
146144

147145
if(ENABLE_ASAN)
146+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
147+
message(FATAL_ERROR "Address Sanitizer is not supported on Intel compiler.")
148+
endif()
148149
add_compile_options(
149150
-fsanitize=address
150151
-fno-omit-frame-pointer
@@ -206,13 +207,16 @@ if(ENABLE_DEEPKS)
206207
FetchContent_Declare(
207208
libnpy
208209
GIT_REPOSITORY https://github.com/llohse/libnpy.git
210+
GIT_SHALLOW TRUE
211+
GIT_PROGRESS TRUE
209212
)
210213
FetchContent_MakeAvailable(libnpy)
211214
endif()
212215
include_directories(${libnpy_SOURCE_DIR}/include)
213216
add_compile_definitions(__DEEPKS)
214217
endif()
215218

219+
list(APPEND math_libs m)
216220
target_link_libraries(${ABACUS_BIN_NAME} ${math_libs})
217221

218222
if(DEFINED Libxc_DIR)
@@ -244,17 +248,18 @@ add_compile_definitions(
244248
)
245249

246250
IF (BUILD_TESTING)
251+
set(CMAKE_CXX_STANDARD 14) # Required in orbital
247252
include(CTest)
248253
enable_testing()
249-
find_package(Threads)
250-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
251254
find_package(GTest HINTS /usr/local/lib/ ${GTEST_DIR})
252255
if(NOT ${GTest_FOUND})
253256
include(FetchContent)
254257
FetchContent_Declare(
255258
googletest
256259
GIT_REPOSITORY https://github.com/google/googletest.git
257260
GIT_TAG "origin/main"
261+
GIT_SHALLOW TRUE
262+
GIT_PROGRESS TRUE
258263
)
259264
FetchContent_MakeAvailable(googletest)
260265
endif()
@@ -267,8 +272,11 @@ IF (BUILD_TESTING)
267272
add_executable(${UT_TARGET} ${UT_SOURCES})
268273
#dependencies & link library
269274
target_link_libraries(${UT_TARGET} ${UT_LIBS}
270-
OpenMP::OpenMP_CXX pthread GTest::gtest_main GTest::gmock_main)
271-
install(TARGETS ${UT_TARGET} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../../../tests )
275+
Threads::Threads GTest::gtest_main GTest::gmock_main)
276+
if(USE_OPENMP)
277+
target_link_libraries(${UT_TARGET} OpenMP::OpenMP_CXX)
278+
endif()
279+
install(TARGETS ${UT_TARGET} DESTINATION ${CMAKE_BINARY_DIR}/tests )
272280
add_test(NAME ${UT_TARGET}
273281
COMMAND ${UT_TARGET}
274282
WORKING_DIRECTORY $<TARGET_FILE_DIR:${UT_TARGET}>
@@ -290,6 +298,7 @@ target_link_libraries(${ABACUS_BIN_NAME}
290298
io
291299
ions
292300
lcao
301+
gint
293302
parallel
294303
mrrr
295304
pdiag
@@ -302,7 +311,6 @@ target_link_libraries(${ABACUS_BIN_NAME}
302311
hamilt
303312
psi
304313
esolver
305-
-lm
306314
)
307315

308316
install(PROGRAMS ${ABACUS_BIN_PATH}

Dockerfile.gnu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
FROM debian:bullseye-slim
22

3-
RUN apt-get update && apt-get install -y --no-install-recommends git g++ gfortran libssl-dev make cmake vim wget bc unzip \
3+
RUN apt-get update && apt-get install -y --no-install-recommends git g++ gfortran libssl-dev make cmake vim wget bc unzip python3-numpy\
44
&& apt-get install -y --no-install-recommends mpich libmpich-dev
55

6-
ENV GIT_SSL_NO_VERIFY 1
6+
ENV GIT_SSL_NO_VERIFY=1 TERM=xterm-256color
77

88
RUN cd /tmp \
99
&& git clone https://github.com/USCiLab/cereal.git \

docs/input-main.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ This part of variables are used to control the molecular dynamics calculations.
11141114
11151115
- **Type**: Double
11161116
- **Description**: This is the time step(fs) used in md simulation .
1117-
- **Default**: 1
1117+
- **Default**: 1.0
11181118
11191119
#### md_tfirst & md_tlast
11201120
@@ -1178,31 +1178,31 @@ temperature will fluctuate violently; if it is too small, the temperature will t
11781178
11791179
- **Type**: Real
11801180
- **Description**: the velocity of shock wave ($\AA$/fs) for MSST.
1181-
- **Default**: 0
1181+
- **Default**: 0.0
11821182
11831183
#### msst_vis
11841184
11851185
- **Type**: Real
11861186
- **Description**: artificial viscosity (mass/length/time) for MSST.
1187-
- **Default**: 0
1187+
- **Default**: 0.0
11881188
11891189
#### msst_tscale
11901190
11911191
- **Type**: Real
11921192
- **Description**: reduction in initial temperature (0~1) used to compress volume in MSST.
1193-
- **Default**: 0
1193+
- **Default**: 0.01
11941194
11951195
#### msst_qmass
11961196
1197-
- **Type**: Double
1197+
- **Type**: Real
11981198
- **Description**: Inertia of extended system variable. Used only when md_type is 4, you should set a number which is larger than 0. Note that Qmass of NHC is set by md_tfreq.
11991199
- **Default**: No default
12001200
12011201
#### md_damp
12021202
12031203
- **Type**: Real
12041204
- **Description**: damping parameter (fs) used to add force in Langevin method.
1205-
- **Default**: 1
1205+
- **Default**: 1.0
12061206
12071207
### DFT+U correction
12081208
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
etotref
2-
etotperatomref
3-
totalforceref 0.0
4-
totalstressref 0.0
5-
totaltimeref
1+
etotref -57838.0048262096606777
2+
etotperatomref -112.9648531762
3+
totalforceref 27.819520
4+
totalstressref 5537.133126
5+
totaltimeref +2495.54754

examples/performance/run.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ check_out() {
3737
cal=$(grep "$key" $outfile | awk '{printf "%.'$ca'f\n",$2}')
3838
ref=$(grep "$key" result.ref | awk '{printf "%.'$ca'f\n",$2}')
3939
deviation=$(awk 'BEGIN {x='$ref';y='$cal';if (x<y) {a=y-x} else {a=x-y};printf "%.'$ca'f\n",a}')
40-
deviation1=$(awk 'BEGIN{print '$deviation'*(10**'$ca')}')
41-
40+
deviation1=$(awk 'BEGIN{print '$deviation'*(10^'$ca')}')
41+
4242
if [ $key == "totaltimeref" ]; then
4343
break
4444
fi
@@ -80,7 +80,7 @@ run_abacus() {
8080
lastword=$(tail -1 result.log | awk '{print $1}')
8181
fi
8282
if [[ $lastword != "SEE" ]]; then
83-
/usr/bin/time -v mpirun -n $1 -env OMP_NUM_THREADS=$2 $abacus 2>time.log tee result.log
83+
OMP_NUM_THREADS=$2 /usr/bin/time -v mpirun -n $1 $abacus 2>time.log | tee result.log
8484
else
8585
printf "**result.log is normal end, skip this job** "
8686
fi

examples/performance/sumdat.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ fi
1313
test -f $outf && rm $outf
1414

1515
#title
16-
printf "%20s %7s %8s %8s %6s %6s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s\n" \
17-
"example" "Natoms" "EneCut" "k-points" "NProc" "Niter" "TotTime" "1stSCF" "SCF/iter" \
18-
"Run%" "c_bands%" "s_bands%" "h_psi%" "vloc%" "vnl%" "FFT%" "stress%" "force%" "MaxResSize" > $outf
16+
printf "%20s %15s %7s %8s %8s %6s %6s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s\n" \
17+
"example" "ks_solver" "Natoms" "EneCut" "k-points" "NProc" "Niter" "TotTime" "1stSCF" "SCF/iter" \
18+
"Run%" "h_psi%" "vloc%" "vnl%" "stress%" "force%" "MaxResSize" > $outf
1919

2020
for i in `cat $allcase`;do
2121
if [[ ! -f $i/result.log ]];then
@@ -25,6 +25,7 @@ for i in `cat $allcase`;do
2525
fi
2626

2727
basis=`awk '$1=="basis_type"{print $2}' ${i}/INPUT | tr [A-Z] [a-z]`
28+
solver=`grep ks_solver ${i}/OUT.*/INPUT | awk '{print $2}'`
2829
#echo $basis
2930
if [[ "$basis" == "pw" ]];then
3031
natoms=`sed -n '/ELEMENT NATOM/,/----/'p ${i}/result.log| sed '1d;$d' | awk 'BEGIN{a=0}{a+=$2}END{print a}'`
@@ -36,13 +37,13 @@ for i in `cat $allcase`;do
3637
scf1=`grep -A 1 "ITER ETOT(eV)" ${i}/result.log | awk 'END{printf"%.2f", $NF}'`
3738
totalscf=`awk '$2=="Run"{print $3}' ${i}/result.log`
3839
scfpiter=`awk -v a=$totalscf -v b=$scf1 -v c=$niter 'BEGIN{printf"%.2f",(a-b)/(c-1)}'`
39-
fft=`awk '$2=="FFT3D"{printf"%.1f",$6}' ${i}/result.log`
40+
#fft=`awk '$2=="FFT3D"{printf"%.1f",$6}' ${i}/result.log`
4041
hpsi=`awk '$2=="h_psi"{printf"%.1f",$6}' ${i}/result.log`
4142
vloc=`awk '$2=="vloc"{printf"%.1f",$6}' ${i}/result.log`
4243
vnl=`awk '$2=="vnl"{printf"%.1f",$6}' ${i}/result.log`
4344
sc=`awk '$2=="Run"{printf"%.1f",$6}' ${i}/result.log`
44-
cbands=`awk '$2=="c_bands"{printf"%.1f",$6}' ${i}/result.log`
45-
sbands=`awk '$2=="sum_band"{printf"%.1f",$6}' ${i}/result.log`
45+
#cbands=`awk '$2=="c_bands"{printf"%.1f",$6}' ${i}/result.log`
46+
#sbands=`awk '$2=="sum_band"{printf"%.1f",$6}' ${i}/result.log`
4647
stress=`awk '$2=="cal_stress"{printf"%.1f",$6}' ${i}/result.log`
4748
force=`awk '$2=="cal_force_nl"{printf"%.1f",$6}' ${i}/result.log`
4849
elif [[ "$basis" == "lcao" ]];then
@@ -55,13 +56,13 @@ for i in `cat $allcase`;do
5556
scf1=`grep -A 1 "ITER ETOT(eV)" ${i}/result.log | awk 'END{printf"%.2f", $NF}'`
5657
totalscf=`awk '$1=="Run"{print $3}' ${i}/result.log`
5758
scfpiter=`awk -v a=$totalscf -v b=$scf1 -v c=$niter 'BEGIN{printf"%.2f",(a-b)/(c-1)}'`
58-
fft="-"
59+
#fft="-"
5960
hpsi="-"
6061
vloc=`awk '$2=="vlocal"{printf"%.1f",$6}' ${i}/result.log`
6162
vnl="-"
6263
sc=`awk '$2=="Run"{printf"%.1f",$6}' ${i}/result.log`
63-
cbands=`awk '$2=="cal_bands"{printf"%.1f",$6}' ${i}/result.log`
64-
sbands=`awk '$2=="sum_bands"{printf"%.1f",$6}' ${i}/result.log`
64+
#cbands=`awk '$2=="cal_bands"{printf"%.1f",$6}' ${i}/result.log`
65+
#sbands=`awk '$2=="sum_bands"{printf"%.1f",$6}' ${i}/result.log`
6566
stress=`awk '$2=="evaluate_vl_stress"{printf"%.1f",$6}' ${i}/result.log`
6667
force=`awk '$2=="evaluate_vl_force"{printf"%.1f",$6}' ${i}/result.log`
6768
else
@@ -70,8 +71,8 @@ for i in `cat $allcase`;do
7071
fi
7172
maxres=`grep "Maximum resident set size" ${i}/time.log | awk '{print $NF}'`
7273

73-
printf "%20s %7s %8s %8s %6s %6s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %s\n" \
74-
$i $natoms $encut $kpt $nproc $niter $tottime $scf1 $scfpiter $sc $cbands $sbands $hpsi $vloc $vnl $fft \
74+
printf "%20s %15s %7s %8s %8s %6s %6s %8s %8s %8s %8s %8s %8s %8s %8s %8s %s\n" \
75+
$i $solver $natoms $encut $kpt $nproc $niter $tottime $scf1 $scfpiter $sc $hpsi $vloc $vnl \
7576
$stress $force $maxres >> $outf
7677

7778
done

source/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ add_subdirectory(module_surchem)
1313
add_subdirectory(module_deepks)
1414
add_subdirectory(module_xc)
1515
add_subdirectory(module_esolver)
16+
add_subdirectory(module_gint)
1617
add_subdirectory(src_io)
1718
add_subdirectory(src_ions)
1819
add_subdirectory(src_lcao)

0 commit comments

Comments
 (0)