Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 90 additions & 35 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,31 @@ name: CUDA Test
on:
workflow_dispatch:
pull_request:
schedule:
# Nightly at 18:00 UTC: run the full 01_PW GPU case list. Pull requests
# run the smaller CASES_GPU_SMOKE.txt subset instead.
- cron: '0 18 * * *'

defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.suite || 'build' }}
cancel-in-progress: true

jobs:
test:
name: Test on CUDA Build
# ── Job 1: build once, publish the binary as an artifact ─────────────
build:
name: Build CUDA
runs-on: gpu
if: github.repository_owner == 'deepmodeling'
container:
image: ghcr.io/deepmodeling/abacus-cuda
volumes:
- /tmp/ccache:/github/home/.ccache
options: --gpus all

steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -34,6 +39,12 @@ jobs:
sudo apt-get update
sudo apt-get install -y ccache xz-utils ninja-build pkg-config

- name: Setup ccache
run: |
ccache --max-size=30G
ccache --zero-stats
ccache -s

- name: Install external tools from toolchain
run: |
cd toolchain
Expand All @@ -46,50 +57,94 @@ jobs:
nvidia-smi
source toolchain/install/setup
rm -rf build
cmake -B build -G Ninja -DUSE_CUDA=ON -DBUILD_TESTING=ON -DENABLE_FLOAT_FFTW=ON
cmake --build build -j4
# Build only for the GPU architecture of the CI runner instead of
# the default 7 architectures (60/70/75/80/86/89/90). The CI GPU
# pool is Tesla V100 (sm_70, see the nvidia-smi output above);
# update this if the runner GPU model changes (V100=70, A100=80,
# H100=90, T4=75). This cuts nvcc work by ~7x and allows safe -j.
cmake -B build -G Ninja -DUSE_CUDA=ON -DBUILD_TESTING=ON -DENABLE_FLOAT_FFTW=ON \
-DCMAKE_CUDA_ARCHITECTURES=70 \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/install"
cmake --build build -j "$(nproc)"
cmake --install build

- name: ccache statistics
if: always()
run: ccache -s

- name: Module_LCAO CUDA Unittests
env:
GTEST_COLOR: 'yes'
OMP_NUM_THREADS: '2'
run: |
ctest --test-dir build -V --timeout 1700 -R '^(MODULE_LCAO_tddft_radial_interpolation_cuda_test|MODULE_LCAO_tddft_snap_psibeta_half_test)$'

- name: Test 11_PW_GPU
run: |
cd tests/11_PW_GPU
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: abacus-cuda-bin
path: install/
retention-days: 1

- name: Test 12_NAO_Gamma_GPU
run: |
cd tests/12_NAO_Gamma_GPU
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
# ── Job 2: matrix instances run their test suites in parallel ────────
gpu-test:
name: Test ${{ matrix.suite }}
needs: build
runs-on: gpu
if: github.repository_owner == 'deepmodeling'
container:
image: ghcr.io/deepmodeling/abacus-cuda
options: --gpus all
strategy:
fail-fast: false
matrix:
suite:
- 11_PW_GPU
- 12_NAO_Gamma_GPU
- 13_NAO_multik_GPU
- 15_rtTDDFT_GPU
- 16_SDFT_GPU
- 01_PW

- name: Test 13_NAO_multik_GPU
run: |
cd tests/13_NAO_multik_GPU
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
steps:
- name: Checkout test scripts
uses: actions/checkout@v7

- name: Test 15_rtTDDFT_GPU
run: |
cd tests/15_rtTDDFT_GPU
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
- name: Download binary artifact
uses: actions/download-artifact@v4
with:
name: abacus-cuda-bin
path: install/

- name: Make binary executable
run: find install/bin -type f -exec chmod +x {} \;

- name: Test 16_SDFT_GPU
- name: Select 01_PW case list
if: matrix.suite == '01_PW'
run: |
cd tests/16_SDFT_GPU
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
# PRs run the smoke subset; schedule/dispatch runs the full list.
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "CASE_FILE=CASES_GPU_SMOKE.txt" >> "$GITHUB_ENV"
else
echo "CASE_FILE=CASES_GPU.txt" >> "$GITHUB_ENV"
fi

- name: Test 01_PW on GPU
- name: Test ${{ matrix.suite }}
env:
GTEST_COLOR: 'yes'
OMP_NUM_THREADS: '2'
run: |
cd tests/01_PW
find . -name INPUT | while read f; do
if grep -q "^device" "$f"; then
sed -i 's/^device.*/device gpu/' "$f"
else
echo "device gpu" >> "$f"
fi
done
bash ../integrate/Autotest.sh -n 1 -a abacus -f CASES_GPU.txt
export PATH="${GITHUB_WORKSPACE}/install/bin:${PATH}"
cd "tests/${{ matrix.suite }}"
if [ "${{ matrix.suite }}" = "01_PW" ]; then
find . -name INPUT | while read f; do
if grep -q "^device" "$f"; then
sed -i 's/^device.*/device gpu/' "$f"
else
echo "device gpu" >> "$f"
fi
done
bash ../integrate/Autotest.sh -n 2 -f "$CASE_FILE"
else
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
fi
29 changes: 29 additions & 0 deletions tests/01_PW/CASES_GPU_SMOKE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Smoke subset of CASES_GPU.txt for pull_request runs (~1/3 of the cases,
# chosen to cover: basic SCF with different pseudopotentials, diagonalization
# solvers CG/David/DS_sca, spin variants nspin=1/2/4, smearing, charge
# mixing, force/stress, relax/cell-relax, symmetry, vdW, MD, DFT+half and
# output options). The full CASES_GPU.txt list still runs on schedule
# (nightly) and workflow_dispatch triggers.
nscf_out_pot
scf_out_elf
001_PW_UPF100_Al
004_PW_UPF201_Si
006_PW_UPF201_Eu
020_PW_kspace
022_PW_CG
023_PW_DA
025_PW_DS_sca
029_PW_15_CF_CS_S1_smallg
035_PW_15_SO
036_PW_AF
037_PW_FM
041_PW_GA_smear
045_PW_BD_chgmix
051_PW_OBOD_MemSaver
058_PW_RE_MB
066_PW_CR_fix_abc
073_PW_SY
083_PW_sol_H2
090_PW_VWR
101_PW_MD_1O
209_PW_DFTHALF
Loading