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
116 changes: 116 additions & 0 deletions .github/workflows/cache_warmer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Cache Warmer

# Primes the self-hosted runners' /tmp/ccache with the latest develop build
# after every merge. Without this, the first PR runs after a large refactor
# lands in develop find a cold/stale ccache and pay a full rebuild
# (observed: Build step 2.7 min warm vs 37.5 min stale).
#
# IMPORTANT: keep the cmake configure flags below in sync with test.yml and
# cuda.yml — ccache entries are keyed on the actual compiler flags, so the
# warmer only helps if it compiles with the same configuration as the CI.

on:
push:
branches:
- develop
workflow_dispatch:

concurrency:
group: cache-warmer-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
warm-gnu:
name: Warm X64 ccache
runs-on: X64
if: github.repository_owner == 'deepmodeling'
container:
image: ghcr.io/deepmodeling/abacus-gnu
volumes:
- /tmp/ccache:/github/home/.ccache
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 1
submodules: 'false'

- name: Take ownership of the workspace and update submodules
run: |
sudo chown -R $(whoami) .
git submodule update --init --recursive

- name: Install CI tools
run: |
sudo apt-get update
sudo apt-get install -y gfortran ccache ninja-build
ccache --max-size=30G

- name: Install external tools from toolchain
run: |
cd toolchain
./install_abacus_toolchain_new.sh --with-dftd4=install --dry-run -j8
./scripts/stage4/install_stage4.sh
cd ..

# Mirrors the Configure flags of .github/workflows/test.yml.
- name: Configure & Build (prime ccache, no tests)
run: |
source toolchain/install/setup
cmake -B build -G Ninja \
-DBUILD_TESTING=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DENABLE_MLALGO=ON \
-DENABLE_LIBXC=ON \
-DENABLE_LIBRI=ON \
-DENABLE_GOOGLEBENCH=ON \
-DENABLE_RAPIDJSON=ON \
-DENABLE_FLOAT_FFTW=ON \
-DENABLE_DFTD4=ON
cmake --build build -j8

- name: ccache statistics
run: ccache -s

warm-cuda:
name: Warm gpu ccache
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
with:
submodules: recursive

- name: Install CI tools
run: |
sudo apt-get update
sudo apt-get install -y ccache xz-utils ninja-build pkg-config
ccache --max-size=30G

- name: Install external tools from toolchain
run: |
cd toolchain
./install_abacus_toolchain_new.sh --with-dftd4=install --dry-run -j8
./scripts/stage4/install_stage4.sh
cd ..

# Mirrors the Configure & Build step of .github/workflows/cuda.yml.
- name: Configure & Build (prime ccache, no tests)
run: |
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 -j "$(nproc)"

- name: ccache statistics
run: ccache -s
16 changes: 15 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
# CMake only needs `git log -1` for the commit info; a shallow
# fetch is enough and saves ~10 min on cache-cold runners.
fetch-depth: 1
# We will handle submodules manually after fixing ownership
submodules: 'false'

Expand All @@ -47,6 +49,14 @@ jobs:
xz-utils
sudo pip install clang-format clang-tidy

- name: Setup ccache
run: |
# Default cache size (~10G) is too small for a full -O3 -g build
# plus daily develop churn; raise it and reset per-run counters.
ccache --max-size=30G
ccache --zero-stats
ccache -s

- name: Install external tools from toolchain
run: |
cd toolchain
Expand Down Expand Up @@ -308,3 +318,7 @@ jobs:
OMP_NUM_THREADS: '2'
run: |
ctest --test-dir build -V --timeout 1700 -E 'integrate_test|01_PW|02_NAO_Gamma|03_NAO_multik|04_FF|05_rtTDDFT|06_SDFT|07_OFDFT|08_EXX|09_DeePKS|10_others|11_PW_GPU|12_NAO_Gamma_GPU|13_NAO_multik_GPU|15_rtTDDFT_GPU|16_SDFT_GPU|17_DS_DFTU|MODULE_BASE|MODULE_IO|MODULE_HSOLVER|MODULE_CELL|MODULE_MD|MODULE_PSI|MODULE_ESTATE|MODULE_RI|MODULE_HAMILT|MODULE_PW|MODULE_LCAO|MODULE_AO|MODULE_NAO|MODULE_RELAX|MODULE_LR'

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