diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index 9b9c3254fb..b365611123 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -17,6 +17,9 @@ jobs: 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: @@ -29,10 +32,18 @@ jobs: 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 + sudo apt-get install -y ccache xz-utils ninja-build pkg-config zstd - name: Install external tools from toolchain run: | @@ -41,6 +52,28 @@ jobs: ./scripts/stage4/install_stage4.sh cd .. + - name: Restore ccache + id: ccache + uses: actions/cache/restore@v4 + with: + path: /tmp/ccache.tar.zst + key: ccache-cuda-${{ github.sha }} + restore-keys: | + ccache-cuda- + + - name: Unpack ccache + run: | + if [ -f /tmp/ccache.tar.zst ]; then + 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 + fi + + - name: ccache stats (before build) + run: | + ccache --zero-stats || true + ccache -s + - name: Configure & Build run: | nvidia-smi @@ -51,6 +84,21 @@ jobs: 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' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3f26b5571..3552cf19fd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,9 @@ jobs: name: Test runs-on: X64 if: github.repository_owner == 'deepmodeling' + env: + CCACHE_BASEDIR: ${{ github.workspace }} + CCACHE_MAXSIZE: 5G container: image: ghcr.io/deepmodeling/abacus-gnu volumes: @@ -33,12 +36,21 @@ jobs: sudo chown -R $(whoami) . git submodule update --init --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 \ gfortran \ ccache \ + zstd \ ca-certificates \ pkg-config \ python-is-python3 \ @@ -54,6 +66,28 @@ jobs: ./scripts/stage4/install_stage4.sh cd .. + - name: Restore ccache + id: ccache + uses: actions/cache/restore@v4 + with: + path: /tmp/ccache.tar.zst + key: ccache-gnu-${{ github.sha }} + restore-keys: | + ccache-gnu- + + - name: Unpack ccache + run: | + if [ -f /tmp/ccache.tar.zst ]; then + 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 + fi + + - name: ccache stats (before build) + run: | + ccache --zero-stats || true + ccache -s + - name: Configure run: | source toolchain/install/setup @@ -85,6 +119,21 @@ jobs: cmake --build build -j8 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-gnu-${{ github.sha }} + - name: Check documentation consistency run: | ABACUS_BIN=$(find build -name "abacus_*" -type f -executable | head -1)