Skip to content

Commit 99b0904

Browse files
authored
Merge branch 'deepmodeling:develop' into toolchain
2 parents fc9bf56 + 71ee1d7 commit 99b0904

31 files changed

Lines changed: 1604 additions & 572 deletions

File tree

.github/workflows/doxygen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
uses: actions/configure-pages@v6
4949

5050
- name: Upload artifact
51-
uses: actions/upload-pages-artifact@v4
51+
uses: actions/upload-pages-artifact@v5
5252
with:
5353
path: './doxygen/html'
5454

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Toolchain Full Build Test
2+
on:
3+
schedule:
4+
- cron: "0 0 * * 0"
5+
workflow_dispatch:
6+
inputs:
7+
variants:
8+
description: "Comma-separated variants: gnu,intel,cuda"
9+
required: false
10+
default: "gnu,intel,cuda"
11+
jobs:
12+
full-build-gnu:
13+
if: contains(inputs.variants || 'gnu,intel,cuda', 'gnu')
14+
runs-on: X64
15+
container:
16+
image: ghcr.io/deepmodeling/abacus-gnu
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
- name: Install requirements
21+
run: |
22+
set -euo pipefail
23+
cd toolchain/root_requirements
24+
sudo ./install_requirements_ubuntu.sh
25+
- name: Build toolchain
26+
run: |
27+
set -euo pipefail
28+
cd toolchain
29+
./toolchain_gnu.sh
30+
- name: Build ABACUS
31+
run: |
32+
set -euo pipefail
33+
cd toolchain
34+
./build_abacus_gnu.sh
35+
cd ..
36+
./bin/abacus --version || true
37+
- name: Upload logs
38+
if: always()
39+
uses: actions/upload-artifact@v7
40+
with:
41+
name: toolchain-full-gnu
42+
path: |
43+
toolchain/compile.log
44+
toolchain/compile.err
45+
toolchain/install/setup
46+
toolchain/build/**/make.log
47+
toolchain/build/**/configure.log
48+
toolchain/build/**/cmake.log
49+
if-no-files-found: ignore
50+
51+
full-build-intel:
52+
if: contains(inputs.variants || 'gnu,intel,cuda', 'intel')
53+
runs-on: X64
54+
container:
55+
image: ghcr.io/deepmodeling/abacus-intel
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v6
59+
- name: Install requirements
60+
run: |
61+
set -euo pipefail
62+
cd toolchain/root_requirements
63+
sudo ./install_requirements_ubuntu.sh
64+
- name: Build toolchain
65+
run: |
66+
set -euo pipefail
67+
cd toolchain
68+
./toolchain_intel.sh
69+
- name: Build ABACUS
70+
run: |
71+
set -euo pipefail
72+
cd toolchain
73+
./build_abacus_intel.sh
74+
cd ..
75+
./bin/abacus --version || true
76+
- name: Upload logs
77+
if: always()
78+
uses: actions/upload-artifact@v7
79+
with:
80+
name: toolchain-full-intel
81+
path: |
82+
toolchain/compile.log
83+
toolchain/compile.err
84+
toolchain/install/setup
85+
toolchain/build/**/make.log
86+
toolchain/build/**/configure.log
87+
toolchain/build/**/cmake.log
88+
if-no-files-found: ignore
89+
90+
full-build-cuda:
91+
if: contains(inputs.variants || 'gnu,intel,cuda', 'cuda')
92+
runs-on: nvidia
93+
steps:
94+
- name: Checkout
95+
uses: actions/checkout@v6
96+
- name: Install requirements
97+
run: |
98+
set -euo pipefail
99+
if [ -f /etc/os-release ]; then . /etc/os-release; fi
100+
if [ "${ID:-}" = "ubuntu" ] || [ "${ID_LIKE:-}" = "debian" ]; then
101+
sudo ./toolchain/root_requirements/install_requirements_ubuntu.sh
102+
elif [ "${ID:-}" = "fedora" ] || [ "${ID_LIKE:-}" = "rhel fedora" ]; then
103+
sudo ./toolchain/root_requirements/install_requirements_fedora.sh
104+
else
105+
exit 1
106+
fi
107+
- name: Prepare CUDA and NVHPC
108+
run: |
109+
set -euo pipefail
110+
if command -v nvidia-smi >/dev/null 2>&1; then
111+
nvidia-smi
112+
cap="$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | head -n 1 | tr -d '.' | xargs || true)"
113+
fi
114+
if [ -z "${cap:-}" ]; then cap="70"; fi
115+
echo "GPU_CAP=${cap}" >> "$GITHUB_ENV"
116+
if command -v module >/dev/null 2>&1; then
117+
module use /opt/nvidia/hpc_sdk/modulefiles || true
118+
module load nvhpc/26.1 || module load nvhpc-hpcx-cuda12/25.3
119+
else
120+
exit 1
121+
fi
122+
if [ -d /usr/local/cuda ]; then
123+
echo "CUDA_PATH=/usr/local/cuda" >> "$GITHUB_ENV"
124+
fi
125+
- name: Build toolchain
126+
run: |
127+
set -euo pipefail
128+
cd toolchain
129+
./toolchain_gnu.sh --enable-cuda --gpu-ver "${GPU_CAP}"
130+
- name: Build ABACUS
131+
run: |
132+
set -euo pipefail
133+
cd toolchain
134+
./build_abacus_gnu.sh
135+
cd ..
136+
./bin/abacus --version || true
137+
- name: Upload logs
138+
if: always()
139+
uses: actions/upload-artifact@v7
140+
with:
141+
name: toolchain-full-cuda
142+
path: |
143+
toolchain/compile.log
144+
toolchain/compile.err
145+
toolchain/install/setup
146+
if-no-files-found: ignore
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Toolchain Quick Test
2+
on:
3+
pull_request:
4+
paths:
5+
- toolchain/**
6+
- .github/workflows/toolchain_quick.yml
7+
push:
8+
branches:
9+
- develop
10+
paths:
11+
- toolchain/**
12+
- .github/workflows/toolchain_quick.yml
13+
workflow_dispatch:
14+
jobs:
15+
lint-and-sanity:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
- name: Install tools
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y dos2unix shellcheck
24+
- name: Shell syntax
25+
run: |
26+
set -euo pipefail
27+
while IFS= read -r -d '' f; do
28+
bash -n "$f"
29+
done < <(find toolchain -type f -name '*.sh' -print0)
30+
- name: Python syntax
31+
run: |
32+
python3 -m compileall toolchain
33+
- name: CRLF check
34+
run: |
35+
set -euo pipefail
36+
if grep -RIl $'\r' toolchain | head -n 1 | grep -q .; then
37+
grep -RIl $'\r' toolchain | head -n 50
38+
exit 1
39+
fi
40+
- name: Shellcheck
41+
run: |
42+
set -euo pipefail
43+
shellcheck --version
44+
find toolchain -type f -name '*.sh' -print0 | xargs -0 -n1 shellcheck -x || true
45+
46+
dry-run-matrix:
47+
runs-on: ubuntu-latest
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
variant: [gnu, intel, cuda]
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v6
55+
- name: Install tools
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y dos2unix
59+
- name: Dry run
60+
run: |
61+
set -euo pipefail
62+
cd toolchain
63+
rm -rf build install
64+
find . -type f -name '*.sh' -exec chmod +x {} +
65+
if [ "${{ matrix.variant }}" = "gnu" ]; then
66+
./toolchain_gnu.sh --dry-run --skip-system-checks
67+
elif [ "${{ matrix.variant }}" = "intel" ]; then
68+
./toolchain_intel.sh --dry-run --skip-system-checks
69+
elif [ "${{ matrix.variant }}" = "cuda" ]; then
70+
./toolchain_gnu.sh --dry-run --skip-system-checks --enable-cuda --gpu-ver 70
71+
fi
72+
- name: Upload setup
73+
if: always()
74+
uses: actions/upload-artifact@v7
75+
with:
76+
name: toolchain-${{ matrix.variant }}-dryrun
77+
path: |
78+
toolchain/install/setup
79+
toolchain/compile.log
80+
toolchain/compile.err
81+
if-no-files-found: ignore
82+

.github/workflows/version_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
# Validate version.h matches the release tag
2626
- name: Assert version increment
2727
run: |
28-
CODE_VERSION=$(grep -oP '#define\s+VERSION\s+"\Kv?\d+(\.\d+){2,3}' source/source_main/version.h)
28+
CODE_VERSION=$(grep -oP '#define\s+VERSION\s+"\Kv?\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?' source/source_main/version.h)
2929
3030
if [[ -z "$CODE_VERSION" ]]; then
3131
echo "::error::Failed to extract version from source/source_main/version.h"

docs/advanced/elec_properties/density_matrix.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
# Extracting Density Matrices
22

3-
ABACUS can output the density matrix by adding the keyword "[out_dmk](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-dm)" in INPUT file:
3+
ABACUS can output the density matrix by adding the keyword "[out_dmk](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out_dmk)" in INPUT file:
44
```
55
out_dmk 1
66
```
7-
After finishing the calculation, the information of the density matrix is stroed in files `OUT.${suffix}/SPIN${spin}_DM`, which looks like:
7+
After finishing the calculation, the density matrix is written into `OUT.${suffix}/`.
8+
9+
For current develop versions:
10+
- gamma-only (`gamma_only = 1`): `dmg1_nao.txt` (`nspin=1/4`) or `dms1g1_nao.txt` and `dms2g1_nao.txt` (`nspin=2`)
11+
- multi-k (`gamma_only = 0`): `dmk1g1_nao.txt`, `dmk2g1_nao.txt`, ... (`nspin=1/4`) or `dmk1s1g1_nao.txt`, `dmk1s2g1_nao.txt`, ... (`nspin=2`)
12+
13+
Here `g{istep}` denotes the geometry/step index in the output filename.
14+
15+
For 3.10-LTS, the corresponding keyword is `out_dm`, and file names follow the legacy style such as `SPIN1_DM` and `SPIN2_DM`.
16+
17+
The file content looks like:
818
```
919
test
1020
5.39761
@@ -37,16 +47,23 @@ The following line is dimension of the density matrix, and the rest lines are th
3747

3848
The examples can be found in [examples/density_matrix](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/density_matrix)
3949

40-
- Note: now this function is valid only for LCAO gamma only calcualtion.
50+
- Note: Version difference summary:
51+
- develop: `out_dmk` supports both gamma-only and multi-k-point output.
52+
- 3.10-LTS: use `out_dm`.
4153

4254
## Real-space Density Matrix (CSR format)
4355

4456
ABACUS can also output the real-space density matrix DM(R) in CSR (Compressed Sparse Row) format by setting:
4557
```
4658
out_dmr 1
4759
```
60+
This feature is only valid for multi-k calculations (`gamma_only = 0`).
61+
4862
After the calculation, the density matrix files are written to `OUT.${suffix}/`:
63+
- develop naming pattern: `dmr{s}{spin index}{g}{geometry index}{_nao}.csr`
4964
- `nspin=1`: `dmrs1_nao.csr`
5065
- `nspin=2` (spin-polarized): `dmrs1_nao.csr` (spin-up) and `dmrs2_nao.csr` (spin-down)
5166

67+
For 3.10-LTS, the corresponding keyword is `out_dm1`, and the file names are `data-DMR-sparse_SPIN0.csr` and `data-DMR-sparse_SPIN1.csr`, etc.
68+
5269
These files can be used to restart calculations by setting `init_chg dm` in the INPUT file together with `read_file_dir` pointing to the directory containing the CSR files. This is supported for both `nspin=1` and `nspin=2`.

docs/advanced/input_files/input-main.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,15 +1803,20 @@
18031803

18041804
- **Type**: Boolean \[Integer\](optional)
18051805
- **Availability**: *Numerical atomic orbital basis*
1806-
- **Description**: Whether to output the density matrix for each k-point into files in the folder OUT.${suffix}. The files are named as:
1806+
- **Description**: Whether to output the density matrix for each k-point into files in the folder OUT.${suffix}. For current develop versions, out_dmk writes *_nao.txt files and includes a g{istep} index in the file name:
18071807
- For gamma only case:
1808-
- nspin = 1 and 4: dm_nao.csr;
1809-
- nspin = 2: dms1_nao.csr and dms2_nao.csr for the two spin channels.
1808+
- nspin = 1 and 4: dmg1_nao.txt;
1809+
- nspin = 2: dms1g1_nao.txt and dms2g1_nao.txt for the two spin channels.
18101810
- For multi-k points case:
1811-
- nspin = 1 and 4: dmk1_nao.csr, dmk2_nao.csr, ...;
1812-
- nspin = 2: dmk1s1_nao.csr... and dmk1s2_nao.csr... for the two spin channels.
1811+
- nspin = 1 and 4: dmk1g1_nao.txt, dmk2g1_nao.txt, ...;
1812+
- nspin = 2: dmk1s1g1_nao.txt... and dmk1s2g1_nao.txt... for the two spin channels.
18131813

1814-
> Note: In the 3.10-LTS version, the parameter is named out_dm and the file names are SPIN1_DM and SPIN2_DM, etc.
1814+
Here, g{istep} denotes the geometry/step index in the output file name.
1815+
1816+
> Note: Version difference (develop vs 3.10-LTS):
1817+
>
1818+
> - In develop, out_dmk supports both gamma-only and multi-k-point density-matrix output.
1819+
> - In 3.10-LTS, the corresponding keyword is out_dm, and the output files are SPIN1_DM and SPIN2_DM, etc.
18151820
- **Default**: False
18161821

18171822
### out_dmr

0 commit comments

Comments
 (0)