Skip to content

Commit 9063986

Browse files
authored
Merge branch 'deepmodeling:develop' into develop
2 parents 0b2dce3 + 7df0daf commit 9063986

File tree

630 files changed

+145365
-12672
lines changed

Some content is hidden

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

630 files changed

+145365
-12672
lines changed

.github/workflows/cuda.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CUDA Test
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
start-runner:
8+
name: Start self-hosted EC2 runner
9+
runs-on: ubuntu-latest
10+
outputs:
11+
label: ${{ steps.start-ec2-runner.outputs.label }}
12+
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
13+
steps:
14+
- name: Configure AWS credentials
15+
uses: aws-actions/configure-aws-credentials@v1
16+
with:
17+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
18+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19+
aws-region: us-east-2
20+
- name: Start EC2 runner
21+
id: start-ec2-runner
22+
uses: machulav/ec2-github-runner@v2
23+
with:
24+
mode: start
25+
github-token: ${{ secrets.PAT }}
26+
ec2-image-id: ami-04cd9fec4a7a39019
27+
ec2-instance-type: g4dn.xlarge
28+
subnet-id: subnet-72d3e53e
29+
security-group-id: sg-06b0c93122c08aeab
30+
31+
test:
32+
name: Do the job on the runner
33+
needs: start-runner # required to start the main job when the runner is ready
34+
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
35+
container:
36+
image: ghcr.io/deepmodeling/abacus-development-kit:cuda
37+
options: --gpus all
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v3
41+
- name: Build cuSolver
42+
run: |
43+
nvidia-smi
44+
cmake -B build -DUSE_CUSOLVER_LCAO=ON
45+
cmake --build build -j4
46+
cmake --install build
47+
- name: Test
48+
run: |
49+
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64
50+
cd tests/integrate
51+
echo "ks_solver cusolver" >> ./270_NO_MD_2O/INPUT
52+
./Autotest.sh -r 270_NO_MD_2O
53+
54+
stop-runner:
55+
name: Stop self-hosted EC2 runner
56+
needs:
57+
- start-runner # required to get output from the start-runner job
58+
- test # required to wait when the main job is done
59+
runs-on: ubuntu-latest
60+
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
61+
steps:
62+
- name: Configure AWS credentials
63+
uses: aws-actions/configure-aws-credentials@v1
64+
with:
65+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
66+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
67+
aws-region: us-east-2
68+
- name: Stop EC2 runner
69+
uses: machulav/ec2-github-runner@v2
70+
with:
71+
mode: stop
72+
github-token: ${{ secrets.PAT }}
73+
label: ${{ needs.start-runner.outputs.label }}
74+
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}

.github/workflows/container.yml renamed to .github/workflows/devcontainer.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
jobs:
99
build_container_and_push:
1010
runs-on: ubuntu-latest
11+
if: github.repository_owner == 'deepmodeling'
1112
strategy:
1213
matrix:
1314
dockerfile: ["gnu","intel","cuda"]
@@ -25,10 +26,19 @@ jobs:
2526
username: ${{ github.actor }}
2627
password: ${{ secrets.GITHUB_TOKEN }}
2728

29+
- name: Login to Aliyun Registry
30+
uses: docker/login-action@v1
31+
with:
32+
registry: ${{ secrets.DP_HARBOR_REGISTRY }}
33+
username: ${{ secrets.DP_HARBOR_USERNAME }}
34+
password: ${{ secrets.DP_HARBOR_PASSWORD }}
35+
2836
- name: Build and Push Container
2937
uses: docker/build-push-action@v2
3038
with:
31-
tags: ghcr.io/${{ github.repository_owner }}/abacus-development-kit:${{ matrix.dockerfile }}
39+
tags: |
40+
ghcr.io/${{ github.repository_owner }}/abacus-development-kit:${{ matrix.dockerfile }}
41+
${{ secrets.DP_HARBOR_REGISTRY }}/dplc/abacus-${{ matrix.dockerfile }}:latest
3242
file: Dockerfile.${{ matrix.dockerfile }}
3343
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/abacus-development-kit:${{matrix.dockerfile}}
3444
cache-to: type=inline

.github/workflows/image.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build Image
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
build_container_and_push:
10+
runs-on: ubuntu-latest
11+
if: github.repository_owner == 'deepmodeling'
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Setup Docker Buildx
17+
uses: docker/setup-buildx-action@v1
18+
19+
- name: Login to GitHub Container Registry
20+
uses: docker/login-action@v1
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Login to Aliyun Registry
27+
uses: docker/login-action@v1
28+
with:
29+
registry: ${{ secrets.DP_HARBOR_REGISTRY }}
30+
username: ${{ secrets.DP_HARBOR_USERNAME }}
31+
password: ${{ secrets.DP_HARBOR_PASSWORD }}
32+
33+
- name: Build and Push Container
34+
uses: docker/build-push-action@v2
35+
with:
36+
tags: |
37+
ghcr.io/${{ github.repository_owner }}/abacus:latest
38+
${{ secrets.DP_HARBOR_REGISTRY }}/dplc/abacus:latest
39+
file: Dockerfile
40+
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/abacus:latest
41+
cache-to: type=inline
42+
push: true

.github/workflows/performance.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Performance test
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
test:
8+
name: Performance test
9+
runs-on: self-hosted
10+
strategy:
11+
matrix:
12+
tag: ["gnu", "intel"]
13+
if: github.repository_owner == 'deepmodeling'
14+
container: ghcr.io/${{ github.repository_owner }}/abacus-development-kit:${{ matrix.tag }}
15+
timeout-minutes: 2880
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
- name: Install Requirements
20+
run: |
21+
apt install -y time
22+
- name: Build
23+
run: |
24+
cmake -B build -DENABLE_LIBXC=ON
25+
cmake --build build -j16
26+
cmake --install build
27+
- name: Test
28+
run: |
29+
test -e /opt/intel/oneapi/setvars.sh && . /opt/intel/oneapi/setvars.sh
30+
cd examples/performance/
31+
bash run.sh
32+
- name: Show Result
33+
run: |
34+
cat examples/performance/sumall.dat

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
ref: "refs/pull/${{ github.event.number }}/merge"
1717
- name: Build
1818
run: |
19-
cmake -B build -DBUILD_TESTING=ON -DENABLE_DEEPKS=ON
19+
cmake -B build -DBUILD_TESTING=ON -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON
2020
cmake --build build -j8
2121
cmake --install build
2222
- name: Test

CMakeLists.txt

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
########################################
22
# CMake build system
33
# This file is part of ABACUS
4-
cmake_minimum_required(VERSION 3.18)
4+
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
1212
)
1313

1414
option(ENABLE_DEEPKS "Enable DeePKS functionality" OFF)
1515
option(ENABLE_LIBXC "Enable LibXC functionality" OFF)
16-
option(USE_CUDA "Enable support to CUDA." OFF)
16+
option(USE_CUDA "Enable support to CUDA for PW." OFF)
17+
option(USE_CUSOLVER_LCAO "Enable support to CUSOLVER for LCAO." OFF)
1718
option(USE_ROCM "Enable support to ROCm." OFF)
1819
option(USE_OPENMP " Enable OpenMP in abacus." ON)
1920
option(ENABLE_ASAN "Enable AddressSanitizer" OFF)
2021
option(BUILD_TESTING "Build ABACUS unit tests" OFF)
2122
option(GENERATE_TEST_REPORTS "Enable test report generation" OFF)
2223

2324
set(ABACUS_BIN_NAME abacus)
24-
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)
25+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)
2526
set(ABACUS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source)
2627
set(ABACUS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)
2728
set(ABACUS_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR}/${ABACUS_BIN_NAME})
2829
include_directories(${ABACUS_SOURCE_DIR})
2930
add_executable(${ABACUS_BIN_NAME} source/main.cpp)
31+
set(CMAKE_CXX_STANDARD 11)
32+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3033
add_compile_options(-O2 -g)
31-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings" )
34+
add_compile_options(-Wno-write-strings)
3235

3336
find_package(Cereal REQUIRED)
3437
include_directories(${Cereal_INCLUDE_DIR})
@@ -51,32 +54,41 @@ if(USE_OPENMP)
5154
find_package(OpenMP REQUIRED)
5255
target_link_libraries(${ABACUS_BIN_NAME} OpenMP::OpenMP_CXX)
5356
add_compile_options(${OpenMP_CXX_FLAGS})
54-
#add_compile_definitions(_OPENMP)
5557
endif()
5658

57-
set(CMAKE_CXX_STANDARD 11)
5859
include(CheckLanguage)
5960
check_language(CUDA)
6061
if(CMAKE_CUDA_COMPILER)
61-
if(NOT DEFINED USE_CUDA)
62-
message("CUDA components detected. \nWill build the CUDA version of ABACUS.")
63-
set(USE_CUDA ON)
62+
if(NOT DEFINED USE_CUDA OR NOT DEFINED USE_CUSOLVER_LCAO)
63+
if (NOT DEFINED USE_CUDA AND NOT DEFINED USE_CUSOLVER_LCAO)
64+
message("CUDA components detected. \nWill build the CUDA for PW version of ABACUS by default.")
65+
set(USE_CUDA ON)
66+
set(USE_CUSOLVER_LCAO OFF)
67+
elseif (NOT DEFINED USE_CUDA)
68+
set(USE_CUDA OFF)
69+
else()
70+
set(USE_CUSOLVER_LCAO OFF)
71+
endif()
6472
else()
65-
if(NOT USE_CUDA)
66-
message(WARNING "CUDA components detected, but USE_CUDA set to OFF. \nNOT building CUDA version of ABACUS.")
73+
if(NOT USE_CUDA AND NOT USE_CUSOLVER_LCAO)
74+
message(STATUS "CUDA components detected, but both USE_CUDA and USE_CUSOLVER_LCAO set to OFF. NOT building CUDA version of ABACUS.")
75+
elseif (USE_CUDA AND USE_CUSOLVER_LCAO)
76+
message(FATAL_ERROR "USE_CUDA and USE_CUSOLVER_LCAO set, but now they not allowed to coexist.")
6777
endif()
6878
endif()
6979
else() # CUDA not found
70-
if (USE_CUDA)
71-
message(FATAL_ERROR "USE_CUDA set but no CUDA components found.")
80+
if (USE_CUDA OR USE_CUSOLVER_LCAO)
81+
message(FATAL_ERROR "USE_CUDA or USE_CUSOLVER_LCAO set but no CUDA components found.")
7282
set(USE_CUDA OFF)
83+
set(USE_CUSOLVER_LCAO OFF)
7384
endif()
7485
endif()
75-
if(USE_CUDA)
86+
87+
if(USE_CUDA OR USE_CUSOLVER_LCAO)
88+
cmake_minimum_required(VERSION 3.18) # required by `CUDA_ARCHITECTURES` below
7689
set(CMAKE_CXX_STANDARD 14)
7790
set(CMAKE_CXX_EXTENSIONS ON)
78-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
79-
set(CMAKE_CUDA_STANDARD 14)
91+
set(CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})
8092
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
8193
set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER})
8294
enable_language(CUDA)
@@ -92,17 +104,22 @@ if(USE_CUDA)
92104
60 # P100
93105
70 # V100
94106
75 # T4
107+
80 # A100
95108
)
96109
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
97-
add_compile_definitions(__CUDA)
110+
if (USE_CUDA)
111+
add_compile_definitions(__CUDA)
112+
endif()
113+
if (USE_CUSOLVER_LCAO)
114+
add_compile_definitions(__CUSOLVER_LCAO)
115+
endif()
98116
endif()
99117

118+
100119
# Warning: CMake add support to HIP in version 3.21. This is rather a new version.
101120
# Use cmake with AMD-ROCm: https://rocmdocs.amd.com/en/latest/Installation_Guide/Using-CMake-with-AMD-ROCm.html
102121
if(USE_ROCM)
103-
set(CMAKE_CXX_STANDARD 11)
104-
SET(CMAKE_HIP_STANDARD 11)
105-
# set(CMAKE_CXX_STANDARD_REQUIRED True)
122+
SET(CMAKE_HIP_STANDARD ${CMAKE_CXX_STANDARD})
106123
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
107124
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "/opt/rocm/hip")
108125

@@ -125,6 +142,9 @@ if(USE_ROCM)
125142
endif()
126143

127144
if(ENABLE_ASAN)
145+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
146+
message(FATAL_ERROR "Address Sanitizer is not supported on Intel compiler.")
147+
endif()
128148
add_compile_options(
129149
-fsanitize=address
130150
-fno-omit-frame-pointer
@@ -186,13 +206,16 @@ if(ENABLE_DEEPKS)
186206
FetchContent_Declare(
187207
libnpy
188208
GIT_REPOSITORY https://github.com/llohse/libnpy.git
209+
GIT_SHALLOW TRUE
210+
GIT_PROGRESS TRUE
189211
)
190212
FetchContent_MakeAvailable(libnpy)
191213
endif()
192214
include_directories(${libnpy_SOURCE_DIR}/include)
193215
add_compile_definitions(__DEEPKS)
194216
endif()
195217

218+
list(APPEND math_libs m)
196219
target_link_libraries(${ABACUS_BIN_NAME} ${math_libs})
197220

198221
if(DEFINED Libxc_DIR)
@@ -224,17 +247,18 @@ add_compile_definitions(
224247
)
225248

226249
IF (BUILD_TESTING)
250+
set(CMAKE_CXX_STANDARD 14) # Required in orbital
227251
include(CTest)
228252
enable_testing()
229-
find_package(Threads)
230-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
231253
find_package(GTest HINTS /usr/local/lib/ ${GTEST_DIR})
232254
if(NOT ${GTest_FOUND})
233255
include(FetchContent)
234256
FetchContent_Declare(
235257
googletest
236258
GIT_REPOSITORY https://github.com/google/googletest.git
237259
GIT_TAG "origin/main"
260+
GIT_SHALLOW TRUE
261+
GIT_PROGRESS TRUE
238262
)
239263
FetchContent_MakeAvailable(googletest)
240264
endif()
@@ -247,8 +271,11 @@ IF (BUILD_TESTING)
247271
add_executable(${UT_TARGET} ${UT_SOURCES})
248272
#dependencies & link library
249273
target_link_libraries(${UT_TARGET} ${UT_LIBS}
250-
OpenMP::OpenMP_CXX pthread GTest::gtest_main GTest::gmock_main)
251-
install(TARGETS ${UT_TARGET} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../../../tests )
274+
Threads::Threads GTest::gtest_main GTest::gmock_main)
275+
if(USE_OPENMP)
276+
target_link_libraries(${UT_TARGET} OpenMP::OpenMP_CXX)
277+
endif()
278+
install(TARGETS ${UT_TARGET} DESTINATION ${CMAKE_BINARY_DIR}/tests )
252279
add_test(NAME ${UT_TARGET}
253280
COMMAND ${UT_TARGET}
254281
WORKING_DIRECTORY $<TARGET_FILE_DIR:${UT_TARGET}>
@@ -263,6 +290,7 @@ target_link_libraries(${ABACUS_BIN_NAME}
263290
cell
264291
symmetry
265292
md
293+
planewave
266294
surchem
267295
neighbor
268296
orb
@@ -276,8 +304,11 @@ target_link_libraries(${ABACUS_BIN_NAME}
276304
ri
277305
driver
278306
xc
307+
hsolver
308+
elecstate
309+
hamilt
310+
psi
279311
esolver
280-
-lm
281312
)
282313

283314
install(PROGRAMS ${ABACUS_BIN_PATH}

0 commit comments

Comments
 (0)