ci: persist ccache across ephemeral runner pods via actions/cache #9923
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CUDA Test | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| defaults: | |
| run: | |
| shell: bash | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Test on CUDA Build | |
| runs-on: gpu | |
| if: github.repository_owner == 'deepmodeling' | |
| env: | |
| CCACHE_BASEDIR: ${{ github.workspace }} | |
| CCACHE_MAXSIZE: 5G | |
| container: | |
| image: ghcr.io/deepmodeling/abacus-cuda | |
| volumes: | |
| - /tmp/ccache:/github/home/.ccache | |
| options: --gpus all | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7.0.1 | |
| with: | |
| submodules: recursive | |
| - name: Report runner info | |
| run: | | |
| echo "runner_name=$RUNNER_NAME" | |
| case "$RUNNER_NAME" in | |
| gpu-runner-*) echo "runner_type=pod" ;; | |
| *) echo "runner_type=vm" ;; | |
| esac | |
| - name: Install CI tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ccache xz-utils ninja-build pkg-config zstd | |
| - 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 .. | |
| - name: Restore ccache | |
| id: ccache | |
| if: startsWith(runner.name, 'gpu-runner-') | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: /tmp/ccache.tar.zst | |
| key: ccache-cuda-${{ github.sha }} | |
| restore-keys: | | |
| ccache-cuda- | |
| - name: Unpack ccache | |
| if: steps.ccache.outputs.cache-hit == 'true' | |
| run: | | |
| sudo mkdir -p /github/home/.ccache | |
| sudo tar -I zstd -xf /tmp/ccache.tar.zst -C /github/home | |
| sudo chown -R $(whoami) /github/home/.ccache | |
| - name: ccache stats (before build) | |
| run: | | |
| ccache --zero-stats || true | |
| ccache -s | |
| - name: Configure & Build | |
| run: | | |
| nvidia-smi | |
| source toolchain/install/setup | |
| rm -rf build | |
| cmake -B build -G Ninja -DUSE_CUDA=ON -DBUILD_TESTING=ON -DENABLE_FLOAT_FFTW=ON \ | |
| -DCMAKE_CUDA_ARCHITECTURES=70 | |
| cmake --build build -j "$(nproc)" | |
| cmake --install build | |
| - name: ccache stats (after build) | |
| if: always() | |
| run: ccache -s | |
| - name: Pack ccache | |
| if: always() | |
| run: tar -I 'zstd -T0' -cf /tmp/ccache.tar.zst -C /github/home .ccache | |
| - name: Save ccache | |
| if: always() | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: /tmp/ccache.tar.zst | |
| key: ccache-cuda-${{ github.sha }} | |
| - 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: Test 12_NAO_Gamma_GPU | |
| run: | | |
| cd tests/12_NAO_Gamma_GPU | |
| bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt | |
| - name: Test 13_NAO_multik_GPU | |
| run: | | |
| cd tests/13_NAO_multik_GPU | |
| bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt | |
| - name: Test 15_rtTDDFT_GPU | |
| run: | | |
| cd tests/15_rtTDDFT_GPU | |
| bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt | |
| - name: Test 16_SDFT_GPU | |
| run: | | |
| cd tests/16_SDFT_GPU | |
| bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt | |
| - name: Test 01_PW on GPU | |
| 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 |