Skip to content

Sync benchmark env to PyTorch 2.13 to match fvdb-core build (#318) #797

Sync benchmark env to PyTorch 2.13 to match fvdb-core build (#318)

Sync benchmark env to PyTorch 2.13 to match fvdb-core build (#318) #797

Workflow file for this run

name: fvdb-reality-capture Unit Tests
on:
# No paths-ignore here: this workflow provides required status checks, and a
# workflow skipped via paths-ignore never reports them, leaving docs-only PRs
# blocked forever. Instead the check-changes job below detects docs-only
# changes and the expensive jobs are gated on it (reporting "skipped", which
# satisfies the required checks). The push trigger keeps paths-ignore since
# push builds are not required PR checks.
pull_request_target:
branches:
- '**'
push:
branches:
- main
paths-ignore:
- 'CODEOWNERS'
- '**.md'
- 'debug/**'
- 'examples/**'
- 'notebooks/**'
- 'scripts/**'
workflow_dispatch:
inputs:
branch:
description: "Branch to build"
required: true
default: "main"
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
deployments: read
pull-requests: read
issues: read
# Need ID token write permission to use OIDC
id-token: write
jobs:
# Detect whether the PR touches source files or only docs/non-code paths.
# The expensive build/test jobs are gated on this so docs-only PRs skip the
# work while still reporting the required status checks (skipped == passed).
check-changes:
uses: ./.github/workflows/check-changes.yml
##############################################################################
# BUILD FVDB
##############################################################################
start-build-runner:
name: Start CPU-only EC2 runner for build
needs: check-changes
if: needs.check-changes.outputs.should_test == 'true'
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-build-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-build-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::420032683002:role/openvdb-fvdb-github-actions-role
aws-region: us-east-2
- name: Start EC2 runner
id: start-build-runner
uses: machulav/ec2-github-runner@v2.4.3
with:
mode: start
github-token: ${{ secrets.EC2_RUNNERS_ACTION }}
ec2-image-id: ami-0e14a711dad782a70
ec2-instance-type: m6a.8xlarge
subnet-id: subnet-03f2320d6e6e0005b
security-group-id: sg-0cd08bd89d6212223
fvdb-reality-capture-build:
name: fvdb-reality-capture Build
needs: start-build-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-build-runner.outputs.label }} # run the job on the newly created runner
container:
image: aswf/ci-openvdb:2024-clang17.2
env:
PYTHONPATH: ""
CPM_SOURCE_CACHE: "/__w/cpm_cache"
CONDA_OVERRIDE_CUDA: "13.0" # this is to build an environment on machines that lack a CUDA device and needs to match the CUDA version in the build_environment.yml file
options: --rm
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.ref || github.ref }}
# For pull requests, this automatically checks out the merge commit
# For pushes, this checks out the pushed commit
- name: Fetch PR branch
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global --add safe.directory "$(pwd)"
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch
- name: Merge PR branch into base
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git merge pr_branch
# - name: Simulate merge for push events
# if: github.event_name == 'push'
# run: |
# echo "Push event detected - simulating merge with target branch"
# git config --global user.name "github-actions[bot]"
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git config --global --add safe.directory "$(pwd)"
# # Get the target branch (main in this case, since push is only on main)
# TARGET_BRANCH="main"
# CURRENT_COMMIT="${{ github.sha }}"
# echo "Creating merge simulation: merging $CURRENT_COMMIT into $TARGET_BRANCH"
# git fetch origin $TARGET_BRANCH
# git checkout $TARGET_BRANCH
# git merge --no-ff $CURRENT_COMMIT --message "CI: Simulating merge of $CURRENT_COMMIT into $TARGET_BRANCH"
# TODO: DRY this up with an anchor
- name: Clone fvdb-core
id: clone_fvdb_core
run: |
echo "Cloning fvdb-core"
pwd
git clone https://github.com/openvdb/fvdb-core.git
pushd fvdb-core
FVDB_CORE_COMMIT_HASH=$(git rev-parse HEAD)
echo "fvdb_core_commit_hash=$FVDB_CORE_COMMIT_HASH" >> "$GITHUB_OUTPUT"
popd
- name: Check if fvdb-core whl exists
uses: softwareforgood/check-artifact-v4-existence@v0
id: check_fvdb_core_wheel_artifact
with:
name: fvdb-wheel-${{ steps.clone_fvdb_core.outputs.fvdb_core_commit_hash }} # Replace with the actual name of your artifact
- name: Log if fvdb-core wheel already exists
if: steps.check_fvdb_core_wheel_artifact.outputs.exists == 'true'
run: echo "Artifact 'fvdb-wheel-${{ steps.clone_fvdb_core.outputs.fvdb_core_commit_hash }}' exists. No need to rebuild."
# Add further steps here that depend on the artifact's existence
- name: Set up fvdb-core conda env
if: steps.check_fvdb_core_wheel_artifact.outputs.exists == 'false'
uses: mamba-org/setup-micromamba@v2
with:
post-cleanup: 'all'
environment-name: fvdb_build
environment-file: fvdb-core/env/build_environment.yml
- name: Build fvdb-core
if: steps.check_fvdb_core_wheel_artifact.outputs.exists == 'false'
run: |
echo "Building fvdb"
cd fvdb-core
micromamba activate fvdb_build
./build.sh wheel verbose --cuda-arch-list '8.9+PTX'
- name: Upload fvdb wheel
if: steps.check_fvdb_core_wheel_artifact.outputs.exists == 'false'
uses: actions/upload-artifact@v4
with:
name: fvdb-wheel-${{ steps.clone_fvdb_core.outputs.fvdb_core_commit_hash }}
path: fvdb-core/dist/*.whl
retention-days: 2
fvdb-build-stop-runner:
name: Stop CPU-only EC2 runner for build
needs:
- start-build-runner # required to get output from the start-build-runner job
- fvdb-reality-capture-build # required to wait when the main job is done
runs-on: ubuntu-latest
# Don't try to stop a runner that was never started (docs-only PRs skip start-build-runner).
if: ${{ always() && needs.start-build-runner.result != 'skipped' }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::420032683002:role/openvdb-fvdb-github-actions-role
aws-region: us-east-2
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2.4.3
with:
mode: stop
github-token: ${{ secrets.EC2_RUNNERS_ACTION }}
label: ${{ needs.start-build-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-build-runner.outputs.ec2-instance-id }}
##############################################################################
# START FVDB REALITY CAPTURE TESTS GPU RUNNER
##############################################################################
start-tests-gpu-runner:
name: Start EC2 GPU runner for tests
needs: fvdb-reality-capture-build
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-tests-gpu-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-tests-gpu-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::420032683002:role/openvdb-fvdb-github-actions-role
aws-region: us-east-2
- name: Start EC2 GPU runner
id: start-tests-gpu-runner
uses: machulav/ec2-github-runner@v2.4.3
with:
mode: start
github-token: ${{ secrets.EC2_RUNNERS_ACTION }}
ec2-image-id: ami-0f5c0b65fde08ae43
ec2-instance-type: g6.xlarge # 4 CPU-core, L4 GPU
subnet-id: subnet-03f2320d6e6e0005b
security-group-id: sg-0cd08bd89d6212223
##############################################################################
# RUN FVDB REALITY CAPTURE UNIT TESTS
##############################################################################
fvdb-reality-capture-unit-tests:
needs: start-tests-gpu-runner # required to start the main job when the runner is ready
name: fvdb-reality-capture Unit Tests
runs-on: ${{ needs.start-tests-gpu-runner.outputs.label }} # run the job on the newly created runner
container:
image: aswf/ci-openvdb:2024-clang17.2
env:
PYTHONPATH: ""
CPM_SOURCE_CACHE: "/__w/cpm_cache"
options: --rm
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.ref || github.ref }}
# For pull requests, this automatically checks out the merge commit
# For pushes, this checks out the pushed commit
- name: Fetch PR branch
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global --add safe.directory "$(pwd)"
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch
- name: Merge PR branch into base
if: github.event_name == 'pull_request_target'
run: |
cd $GITHUB_WORKSPACE
git merge pr_branch
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::420032683002:role/openvdb-fvdb-github-actions-role
aws-region: us-east-2
- name: Clone fvdb-core
id: clone_fvdb_core
run: |
echo "Cloning fvdb"
pwd
git clone https://github.com/openvdb/fvdb-core.git
pushd fvdb-core
FVDB_CORE_COMMIT_HASH=$(git rev-parse HEAD)
echo "fvdb_core_commit_hash=$FVDB_CORE_COMMIT_HASH" >> "$GITHUB_OUTPUT"
popd
- name: Set up fvdb Conda env
uses: mamba-org/setup-micromamba@v2
with:
cache-environment: false
post-cleanup: 'all'
environment-name: fvdb
environment-file: fvdb-core/env/dev_environment.yml
- name: Download fvdb-core wheel
uses: actions/download-artifact@v4
with:
name: fvdb-wheel-${{ steps.clone_fvdb_core.outputs.fvdb_core_commit_hash }}
path: ./dist
- name: Install wheels
run: |
micromamba activate fvdb
pip install ./dist/*.whl
- name: Build fvdb-reality-capture
run: |
echo "Building fvdb-reality-capture"
micromamba activate fvdb
pip install -e .
- name: Run tests
run: |
micromamba activate fvdb
cd tests;
pytest -v unit benchmarks/test_benchmark_contract.py benchmarks/test_comparison_benchmark.py benchmarks/test_build_gsplat_cli_args.py
##############################################################################
# RUN FVDB DOCUMENTATION TESTS
##############################################################################
# fvdb-reality-capture-docs-test:
# needs: start-tests-gpu-runner # required to start the main job when the runner is ready
# name: fvdb-reality-capture Documentation Tests
# runs-on: ${{ needs.start-tests-gpu-runner.outputs.label }} # run the job on the newly created runner
# container:
# image: aswf/ci-openvdb:2024-clang17.2
# env:
# PYTHONPATH: ""
# options: --rm
# defaults:
# run:
# shell: bash -el {0}
# steps:
# - uses: actions/checkout@v4
# - name: Set up fvdb_test Conda env
# uses: mamba-org/setup-micromamba@v2
# with:
# cache-environment: false
# post-cleanup: 'all'
# environment-name: fvdb_test
# environment-file: env/test_environment.yml
# - name: Download package
# uses: actions/download-artifact@v4
# with:
# name: fvdb-test-package
# path: ./dist
# - name: Install package
# run: |
# micromamba activate fvdb_test
# pip install ./dist/*.whl
# - name: Run tests
# run: |
# micromamba activate fvdb_test
# pytest --markdown-docs docs
##############################################################################
# STOP FVDB TESTS GPU RUNNER
##############################################################################
fvdb-tests-stop-gpu-runner:
name: Stop GPU EC2 runner for tests
needs:
- start-tests-gpu-runner # required to get output from the start-tests-gpu-runner job
- fvdb-reality-capture-unit-tests # required to wait when the main job is done
#- fvdb-reality-capture-docs-test # required to wait when the main job is done
runs-on: ubuntu-latest
# Don't try to stop a runner that was never started (docs-only PRs skip start-tests-gpu-runner).
if: ${{ always() && needs.start-tests-gpu-runner.result != 'skipped' }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::420032683002:role/openvdb-fvdb-github-actions-role
aws-region: us-east-2
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2.4.3
with:
mode: stop
github-token: ${{ secrets.EC2_RUNNERS_ACTION }}
label: ${{ needs.start-tests-gpu-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-tests-gpu-runner.outputs.ec2-instance-id }}