From e7d71aaf6dcd7ed286f93a27687a3005d6222b7b Mon Sep 17 00:00:00 2001 From: Nick Baker Date: Thu, 23 Oct 2025 00:50:26 +0000 Subject: [PATCH] feat: use disk space cleanup in all nvidia builds --- .github/workflows/ci.yaml | 9 +++------ hack/free-disk-space.sh | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100755 hack/free-disk-space.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8fe7a897d..505ae8983 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,11 +36,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - run: ./hack/free-disk-space.sh - run: docker build --file test/images/nvidia/Dockerfile . build-image-nvidia-training: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - run: ./hack/free-disk-space.sh - run: | docker build --file test/images/nvidia-training/Dockerfile test/images/nvidia-training \ --build-arg PYTORCH_BUILD_ENV="MAX_JOBS=$(($(nproc) - 2)) USE_MKLDNN=0 USE_DISTRIBUTED=0 USE_CUDA=0 USE_ROCM=0 USE_CAFFE2=0 USE_QNNPACK=0 USE_NNPACK=0 USE_XNNPACK=0 USE_MPS=0 BUILD_SHARED_LIBS=OFF USE_FLASH_ATTENTION=0 USE_MEM_EFF_ATTENTION=0 BUILD_TEST=0" @@ -48,12 +50,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - # hack to free up disk space for build - # ref: https://github.com/easimon/maximize-build-space/blob/master/action.yml - - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - docker image prune --all --force - docker builder prune -a + - run: ./hack/free-disk-space.sh - run: | docker build --file test/images/nvidia-inference/Dockerfile test/images/nvidia-inference \ --build-arg PYTORCH_BUILD_ENV="MAX_JOBS=$(($(nproc) - 2)) USE_MKLDNN=0 USE_DISTRIBUTED=0 USE_CUDA=0 USE_ROCM=0 USE_CAFFE2=0 USE_QNNPACK=0 USE_NNPACK=0 USE_XNNPACK=0 USE_MPS=0 BUILD_SHARED_LIBS=OFF USE_FLASH_ATTENTION=0 USE_MEM_EFF_ATTENTION=0 BUILD_TEST=0" diff --git a/hack/free-disk-space.sh b/hack/free-disk-space.sh new file mode 100755 index 000000000..08108703f --- /dev/null +++ b/hack/free-disk-space.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -o nounset +set -o errexit +set -o pipefail + +# hack to free up disk space for build +# ref: https://github.com/easimon/maximize-build-space/blob/master/action.yml + +# storage before +sudo df -h + +sudo rm -rf \ + /usr/share/dotnet \ + /usr/local/lib/android \ + /opt/ghc \ + /opt/hostedtoolcache/CodeQL + +docker image prune --all --force +docker builder prune -a + +# storage after +sudo df -h