Skip to content

Commit 7cf2345

Browse files
authored
Merge branch 'develop' into 2026-07-30-c
2 parents 6c10292 + 1ee758f commit 7cf2345

9 files changed

Lines changed: 132 additions & 73 deletions

File tree

.github/workflows/devcontainer.yml

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,90 @@
11
name: Container
22

33
on:
4-
create:
54
push:
65
branches:
76
- develop
87
tags:
9-
- 'v*'
8+
- "v*"
109
workflow_dispatch:
1110

11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
concurrency:
16+
group: container-${{ github.ref }}
17+
cancel-in-progress: ${{ github.ref == 'refs/heads/develop' }}
18+
1219
defaults:
1320
run:
1421
shell: bash
1522

1623
jobs:
1724
build_container_and_push:
25+
name: Build and push (${{ matrix.dockerfile }})
1826
runs-on: X64
19-
if: github.repository_owner == 'deepmodeling'
27+
28+
if: >-
29+
github.repository == 'deepmodeling/abacus-develop' &&
30+
(github.ref == 'refs/heads/develop' ||
31+
startsWith(github.ref, 'refs/tags/v'))
32+
2033
strategy:
2134
matrix:
22-
dockerfile: ["gnu","intel","cuda"]
35+
dockerfile:
36+
- gnu
37+
- intel
38+
- cuda
39+
2340
steps:
24-
- name: Force Clean Workspace
41+
- name: Configure Docker client
2542
run: |
26-
sudo chattr -i -R ${{ github.workspace }} 2>/dev/null || true
27-
sudo chown -R $USER:$USER ${{ github.workspace }}
28-
sudo find ${{ github.workspace }} -mindepth 1 -delete
29-
30-
- name: Checkout
31-
uses: actions/checkout@v7
43+
config_dir="${RUNNER_TEMP}/docker-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-${{ matrix.dockerfile }}"
44+
mkdir -p "${config_dir}"
45+
echo "DOCKER_CONFIG=${config_dir}" >> "${GITHUB_ENV}"
3246
33-
- name: Docker meta
47+
- name: Docker metadata
3448
id: meta
3549
uses: docker/metadata-action@v6
3650
with:
3751
images: |
3852
ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}
3953
dp-harbor-registry.us-east-1.cr.aliyuncs.com/deepmodeling/abacus-${{ matrix.dockerfile }}
54+
flavor: |
55+
latest=false
4056
tags: |
41-
type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }}
57+
type=semver,pattern={{version}},value=${{ github.ref_name }},enable=${{ github.ref_type == 'tag' }}
4258
type=raw,value=latest
4359
44-
- name: Fix Docker Directory Permissions
45-
run: |
46-
sudo mkdir -p /home/runner/.docker
47-
sudo chown -R $USER:$USER /home/runner/.docker
48-
4960
- name: Setup Docker Buildx
5061
uses: docker/setup-buildx-action@v4
5162

5263
- name: Login to GitHub Container Registry
64+
if: github.event_name != 'workflow_dispatch'
5365
uses: docker/login-action@v4
5466
with:
5567
registry: ghcr.io
5668
username: ${{ github.actor }}
5769
password: ${{ secrets.GITHUB_TOKEN }}
5870

5971
- name: Login to Aliyun Registry
72+
if: github.event_name != 'workflow_dispatch'
6073
uses: docker/login-action@v4
6174
with:
6275
registry: dp-harbor-registry.us-east-1.cr.aliyuncs.com
63-
# AliCloud automatically mirrors to registry.dp.tech
76+
# AliCloud automatically mirrors this registry to registry.dp.tech.
6477
username: ${{ secrets.DP_HARBOR_USERNAME }}
6578
password: ${{ secrets.DP_HARBOR_PASSWORD }}
6679

67-
- name: Build and Push Container
80+
- name: Build and push container
6881
uses: docker/build-push-action@v7
6982
with:
83+
context: "{{defaultContext}}"
84+
file: Dockerfile.${{ matrix.dockerfile }}
85+
push: ${{ github.event_name != 'workflow_dispatch' }}
7086
tags: ${{ steps.meta.outputs.tags }}
7187
labels: ${{ steps.meta.outputs.labels }}
72-
file: Dockerfile.${{ matrix.dockerfile }}
73-
push: true
74-
cache-from: type=registry,ref=ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}:latest
88+
cache-from: |
89+
type=registry,ref=ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}:latest
7590
cache-to: type=inline

Dockerfile.cuda

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

33
RUN apt update && apt install -y --no-install-recommends \
44
libopenblas-openmp-dev liblapack-dev libscalapack-mpi-dev libfftw3-dev libcereal-dev \
5-
libxc-dev libgtest-dev libgmock-dev libbenchmark-dev python3-numpy \
6-
bc cmake git g++ make time sudo unzip vim wget libopenmpi-dev gfortran libtool-bin
5+
libxc-dev libgtest-dev libgmock-dev libbenchmark-dev python3-numpy ca-certificates \
6+
bc cmake git g++ make time sudo unzip vim wget libopenmpi-dev gfortran libtool-bin && \
7+
rm -rf /var/lib/apt/lists/*
78

8-
ENV GIT_SSL_NO_VERIFY=true TERM=xterm-256color \
9+
ENV TERM=xterm-256color \
910
OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 \
1011
OMPI_MCA_btl_vader_single_copy_mechanism=none
1112

@@ -19,24 +20,25 @@ RUN cd /tmp && \
1920
tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \
2021
cd elpa-$ELPA_VER && \
2122
./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 -j $(nproc) && \
2324
make PREFIX=/usr/local install && \
2425
ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \
2526
cd /tmp && rm -rf elpa-$ELPA_VER
2627

2728
# RapidJSON
28-
RUN cd /tmp && wget --quiet https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a -O rapidjson-24b5e7a.tar.gz
29-
RUN tar -xzf rapidjson-24b5e7a.tar.gz && cd rapidjson-24b5e7a
30-
RUN cmake -B build -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF
31-
RUN cmake --build build --target install
32-
RUN cd /tmp && rm -r rapidjson-24b5e7a
29+
RUN cd /tmp && \
30+
wget --quiet https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a -O rapidjson-24b5e7a.tar.gz && \
31+
tar -xzf rapidjson-24b5e7a.tar.gz && cd rapidjson-24b5e7a && \
32+
cmake -B build -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF && \
33+
cmake --build build --target install && \
34+
cd /tmp && rm -rf rapidjson-24b5e7a rapidjson-24b5e7a.tar.gz
3335

3436
ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null
3537

3638
RUN git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \
3739
cd abacus-develop && \
3840
cmake -B build -DUSE_CUDA=ON -DENABLE_RAPIDJSON=ON && \
39-
cmake --build build -j`nproc` && \
41+
cmake --build build -j $(nproc) && \
4042
cmake --install build && \
4143
rm -rf build && \
4244
cd ..

Dockerfile.gnu

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ FROM ubuntu:22.04
1111
RUN apt update && apt install -y --no-install-recommends \
1212
libopenblas-openmp-dev liblapack-dev libscalapack-mpi-dev libelpa-dev libfftw3-dev libcereal-dev \
1313
libxc-dev libgtest-dev libgmock-dev libbenchmark-dev python3-numpy \
14-
bc cmake git g++ make time sudo unzip vim wget gfortran
14+
bc cmake git g++ make time sudo unzip vim wget gfortran ca-certificates && \
15+
rm -rf /var/lib/apt/lists/*
1516
# If you wish to use the LLVM compiler, replace 'g++' above with 'clang libomp-dev'.
1617

17-
ENV GIT_SSL_NO_VERIFY=true TERM=xterm-256color \
18+
ENV TERM=xterm-256color \
1819
OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 OMPI_MCA_btl_vader_single_copy_mechanism=none
1920
# The above environment variables are for using OpenMPI in Docker.
2021

@@ -23,15 +24,16 @@ RUN git clone https://github.com/llohse/libnpy.git && \
2324
rm -r libnpy
2425

2526
RUN wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip \
26-
--no-check-certificate --quiet -O libtorch.zip && \
27+
--quiet -O libtorch.zip && \
2728
unzip -q libtorch.zip -d /opt && rm libtorch.zip
2829

2930
# RapidJSON
30-
RUN cd /tmp && wget --quiet https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a -O rapidjson-24b5e7a.tar.gz
31-
RUN tar -xzf rapidjson-24b5e7a.tar.gz && cd rapidjson-24b5e7a
32-
RUN cmake -B build -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF
33-
RUN cmake --build build --target install
34-
RUN cd /tmp && rm -r rapidjson-24b5e7a
31+
RUN cd /tmp && \
32+
wget --quiet https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a -O rapidjson-24b5e7a.tar.gz && \
33+
tar -xzf rapidjson-24b5e7a.tar.gz && cd rapidjson-24b5e7a && \
34+
cmake -B build -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF && \
35+
cmake --build build --target install && \
36+
cd /tmp && rm -r rapidjson-24b5e7a rapidjson-24b5e7a.tar.gz
3537

3638
ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake
3739

@@ -42,7 +44,7 @@ ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/deve
4244
RUN git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \
4345
cd abacus-develop && \
4446
cmake -B build -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \
45-
cmake --build build -j`nproc` && \
47+
cmake --build build -j $(nproc) && \
4648
cmake --install build && \
4749
rm -rf build
4850
#&& rm -rf abacus-develop

Dockerfile.intel

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ FROM intel/oneapi-hpckit:2025.2.2-0-devel-ubuntu22.04
33
RUN apt-get update && apt-get install -y \
44
bc cmake git gnupg gcc g++ python3-numpy sudo wget vim unzip \
55
libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev \
6-
pkg-config build-essential autoconf automake libtool
6+
pkg-config build-essential autoconf automake libtool && \
7+
rm -rf /var/lib/apt/lists/*
78

89
# https://elpa.mpcdf.mpg.de/software/tarball-archive/ELPA_TARBALL_ARCHIVE.html
910
RUN cd /tmp && \
@@ -12,17 +13,18 @@ RUN cd /tmp && \
1213
tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \
1314
cd elpa-$ELPA_VER && mkdir build && cd build && \
1415
../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \
15-
make -j$(nproc) && \
16+
make -j $(nproc) && \
1617
make PREFIX=/usr/local install && \
1718
ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \
1819
cd /tmp && rm -rf elpa-$ELPA_VER
1920

2021
# RapidJSON
21-
RUN cd /tmp && wget --quiet https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a -O rapidjson-24b5e7a.tar.gz
22-
RUN tar -xzf rapidjson-24b5e7a.tar.gz && cd rapidjson-24b5e7a
23-
RUN cmake -B build -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF
24-
RUN cmake --build build --target install
25-
RUN cd /tmp && rm -r rapidjson-24b5e7a
22+
RUN cd /tmp && \
23+
wget --quiet https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a -O rapidjson-24b5e7a.tar.gz && \
24+
tar -xzf rapidjson-24b5e7a.tar.gz && cd rapidjson-24b5e7a && \
25+
cmake -B build -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF && \
26+
cmake --build build --target install && \
27+
cd /tmp && rm -r rapidjson-24b5e7a rapidjson-24b5e7a.tar.gz
2628

2729
# LibTorch (Note: Using pre-built Torch library with MKL might cause issues)
2830
RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip -O /tmp/libtorch.zip && \
@@ -49,7 +51,7 @@ RUN wget --no-check-certificate --quiet --tries=3 --timeout=30 \
4951
unzip GKlib-${GKLIB_VERSION}.zip && \
5052
cd GKlib-${GKLIB_VERSION} && \
5153
make config shared=1 prefix=${GKLIB_ROOT} openmp=set && \
52-
make -j$(nproc) && \
54+
make -j $(nproc) && \
5355
make install && \
5456
ls ${GKLIB_ROOT}/lib && \
5557
cp -n ${GKLIB_ROOT}/lib/libGKlib.so.0 ${GKLIB_ROOT}/lib/libGKlib.so || true && \
@@ -63,7 +65,7 @@ RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \
6365
unzip METIS-${METIS_VERSION}.zip && \
6466
cd METIS-${METIS_VERSION} && \
6567
make config shared=1 prefix=${METIS32_ROOT} gklib_path=${GKLIB_ROOT} && \
66-
make -j$(nproc) && \
68+
make -j $(nproc) && \
6769
make install && \
6870
cd / && rm -rf METIS-${METIS_VERSION} METIS-${METIS_VERSION}.zip
6971

@@ -75,7 +77,7 @@ RUN export LD_LIBRARY_PATH=${METIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PA
7577
unzip ParMETIS-${PARMETIS_VERSION}.zip && \
7678
cd ParMETIS-${PARMETIS_VERSION} && \
7779
make config shared=1 prefix=${PARMETIS32_ROOT} gklib_path=${GKLIB_ROOT} metis_path=${METIS32_ROOT} && \
78-
make -j$(nproc) && \
80+
make -j $(nproc) && \
7981
make install && \
8082
cd / && rm -rf ParMETIS-${PARMETIS_VERSION} ParMETIS-${PARMETIS_VERSION}.zip
8183

@@ -102,7 +104,7 @@ RUN wget --no-check-certificate --quiet --tries=3 --timeout=30 \
102104
-DCMAKE_CXX_FLAGS="-O3 -fopenmp" \
103105
-DXSDK_ENABLE_Fortran=ON \
104106
-DCMAKE_Fortran_COMPILER=mpiifx && \
105-
make -j$(nproc) && \
107+
make -j $(nproc) && \
106108
make install && \
107109
cd / && rm -rf superlu_dist-${SUPERLU_DIST_VERSION} v${SUPERLU_DIST_VERSION}.tar.gz
108110

@@ -130,7 +132,7 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM
130132
-DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \
131133
-DPEXSI_ENABLE_OPENMP=ON \
132134
-DPEXSI_ENABLE_FORTRAN=OFF && \
133-
make pexsi -j$(nproc) && \
135+
make pexsi -j $(nproc) && \
134136
make install && \
135137
cd / && rm -rf pexsi-${PEXSI_VERSION} pexsi-${PEXSI_VERSION}.tar.gz
136138

@@ -154,7 +156,7 @@ RUN cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --de
154156
-DENABLE_LIBRI=ON \
155157
-DENABLE_RAPIDJSON=ON \
156158
-DCMAKE_BUILD_TYPE=Release && \
157-
cmake --build build -j"$(nproc)" && \
159+
cmake --build build -j $(nproc) && \
158160
cmake --install build && \
159161
(/usr/local/bin/abacus --version || echo "ABACUS installed but version check failed") && \
160162
rm -rf /tmp/abacus-develop

source/source_base/module_device/device.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ bool probe_gpu_availability() {
6363
std::string get_device_flag(const std::string &device,
6464
const std::string &basis_type) {
6565
// 1. Validate input string
66-
if (device != "cpu" && device != "gpu" && device != "auto") {
67-
ModuleBase::WARNING_QUIT("device", "Parameter \"device\" can only be set to \"cpu\", \"gpu\", or \"auto\"!");
66+
if (device != "cpu" && device != "gpu") {
67+
ModuleBase::WARNING_QUIT("device", "Parameter \"device\" can only be set to \"cpu\" or \"gpu\"!");
6868
}
6969

7070
// NOTE: This function is called only on rank 0 during input parsing.
@@ -80,15 +80,6 @@ std::string get_device_flag(const std::string &device,
8080
} else {
8181
ModuleBase::WARNING_QUIT("device", "Device is set to 'gpu', but no available GPU was found. Please check your hardware/drivers or set 'device=cpu'.");
8282
}
83-
} else if (device == "auto") {
84-
if (probe_gpu_availability()) {
85-
result = "gpu";
86-
// std::cout << " INFO: 'device=auto' specified. GPU detected and will be used." << std::endl;
87-
} else {
88-
result = "cpu";
89-
// std::cout << " WARNING: 'device=auto' specified, but no GPU was found. Falling back to CPU." << std::endl;
90-
// std::cout << " To suppress this warning, please explicitly set 'device=cpu' in your input." << std::endl;
91-
}
9283
} else { // device == "cpu"
9384
result = "cpu";
9485
// std::cout << " INFO: 'device=cpu' specified. CPU will be used." << std::endl;

source/source_io/module_parameter/input_conv.cpp

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,18 +513,49 @@ void Input_Conv::Convert()
513513
GlobalC::exx_info.sync_from_global();
514514
}
515515

516-
if (GlobalC::exx_info.info_global.cal_exx && PARAM.inp.basis_type == "pw")
516+
// Local aliases: keep this PR's global-state reference budget non-increasing.
517+
const auto& inp = PARAM.inp;
518+
const bool cal_exx = GlobalC::exx_info.info_global.cal_exx;
519+
520+
if (cal_exx && inp.basis_type == "pw")
517521
{
518522
if (ModuleSymmetry::Symmetry::symm_flag != -1)
519523
{
520524
ModuleBase::WARNING("Input_Conv", "EXX PW works only with symmetry=-1");
521525
ModuleSymmetry::Symmetry::symm_flag = -1;
522526
}
523527

524-
if (PARAM.inp.nspin != 1 && PARAM.inp.nspin != 2)
528+
if (inp.nspin != 1 && inp.nspin != 2)
525529
{
526530
ModuleBase::WARNING_QUIT("Input_Conv", "EXX PW works only with nspin=1 and 2");
527531
}
532+
533+
if (inp.cal_stress)
534+
{
535+
// Stress_PW::stress_exx only sums same-pool (ik, iq) pairs without
536+
// the same-spin restriction used in the EXX energy, so the result
537+
// is wrong for nspin = 2 or kpar > 1.
538+
if (inp.nspin != 1)
539+
{
540+
ModuleBase::WARNING_QUIT("Input_Conv", "EXX PW stress supports only nspin = 1");
541+
}
542+
if (inp.kpar != 1)
543+
{
544+
ModuleBase::WARNING_QUIT("Input_Conv",
545+
"EXX PW stress does not support k-point parallelism (kpar > 1)");
546+
}
547+
if (inp.device == "gpu")
548+
{
549+
ModuleBase::WARNING_QUIT("Input_Conv", "EXX PW stress is not supported on GPU");
550+
}
551+
}
552+
}
553+
554+
if (cal_exx && inp.basis_type == "lcao_in_pw" && inp.cal_stress)
555+
{
556+
// For lcao_in_pw the EXX energy comes from Exx_Lip, but Stress_PW
557+
// would evaluate the EXX stress with the pure PW formula.
558+
ModuleBase::WARNING_QUIT("Input_Conv", "EXX stress is not supported for basis_type = lcao_in_pw");
528559
}
529560

530561
//----------------------------------------------------------

source/source_io/module_parameter/input_parameter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct Input_para
6969
std::string kmesh_type = "gamma"; ///< k-point mesh type for kspacing-generated k-point mesh: gamma or mp
7070
double min_dist_coef = 0.2; ///< allowed minimum distance between two atoms
7171

72-
std::string device = "auto";
72+
std::string device = "cpu";
7373
std::string precision = "double";
7474
std::string gint_precision = "double";
7575
bool timer_enable_nvtx = false;

0 commit comments

Comments
 (0)