Skip to content
Draft
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
115 changes: 115 additions & 0 deletions .github/workflows/gpu-benchmark-modal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: GPU Benchmark (Modal)

on:
workflow_dispatch:
inputs:
gpu:
description: 'GPU type (L4, A10G, A100, H100)'
default: 'L4'
type: string
epochs:
description: 'Number of training epochs'
default: '5'
type: string
channels:
description: 'Number of model channels (8=tiny, 32=prod, 64=large)'
default: '32'
type: string
residual_blocks:
description: 'Number of residual blocks (2=tiny, 16=prod)'
default: '16'
type: string
samples:
description: 'Number of samples (0=all eligible)'
default: '50'
type: string
dataset:
description: 'Dataset: s3 (205 samples, matches EC2) or dataset_4 (2885 samples)'
default: 's3'
type: string
wandb_project:
description: 'WandB project name'
default: 'elf-net-ci'
type: string

jobs:
benchmark:
runs-on: ubuntu-latest
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Modal
run: uv pip install --system modal

- name: Run benchmark
id: bench
env:
GPU: ${{ inputs.gpu || 'L4' }}
EPOCHS: ${{ inputs.epochs || '5' }}
CHANNELS: ${{ inputs.channels || '32' }}
RESIDUAL_BLOCKS: ${{ inputs.residual_blocks || '16' }}
SAMPLES: ${{ inputs.samples || '50' }}
DATASET: ${{ inputs.dataset || 's3' }}
WANDB_PROJECT: ${{ inputs.wandb_project || 'elf-net-ci' }}
run: |
OUTPUT=$(modal run modal/benchmark.py \
--gpu "$GPU" \
--epochs "$EPOCHS" \
--channels "$CHANNELS" \
--residual-blocks "$RESIDUAL_BLOCKS" \
--samples "$SAMPLES" \
--dataset "$DATASET" \
--wandb-project "$WANDB_PROJECT" 2>&1 | tee /dev/stderr)

# Parse metrics from output
for key in VAL_LOSS TRAIN_LOSS WALLCLOCK GPU DATASET SAMPLES WANDB_URL; do
val=$(echo "$OUTPUT" | grep -oP "BENCHMARK_${key}=\K.*" || true)
if [ -n "$val" ]; then
echo "BENCHMARK_${key}=${val}" >> "$GITHUB_OUTPUT"
fi
done

- name: Summary
env:
EPOCHS: ${{ inputs.epochs || '5' }}
CHANNELS: ${{ inputs.channels || '32' }}
RESIDUAL_BLOCKS: ${{ inputs.residual_blocks || '16' }}
VAL_LOSS: ${{ steps.bench.outputs.BENCHMARK_VAL_LOSS }}
TRAIN_LOSS: ${{ steps.bench.outputs.BENCHMARK_TRAIN_LOSS }}
WALLCLOCK: ${{ steps.bench.outputs.BENCHMARK_WALLCLOCK }}
GPU: ${{ steps.bench.outputs.BENCHMARK_GPU }}
DATASET: ${{ steps.bench.outputs.BENCHMARK_DATASET }}
SAMPLES: ${{ steps.bench.outputs.BENCHMARK_SAMPLES }}
WANDB_URL: ${{ steps.bench.outputs.BENCHMARK_WANDB_URL }}
WANDB_PROJECT: ${{ inputs.wandb_project || 'elf-net-ci' }}
run: |
echo "## GPU Benchmark Results (Modal)" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "### Configuration" >> "$GITHUB_STEP_SUMMARY"
echo "| Parameter | Value |" >> "$GITHUB_STEP_SUMMARY"
echo "|-----------|-------|" >> "$GITHUB_STEP_SUMMARY"
echo "| Platform | Modal ($GPU) |" >> "$GITHUB_STEP_SUMMARY"
echo "| Epochs | $EPOCHS |" >> "$GITHUB_STEP_SUMMARY"
echo "| Channels | $CHANNELS |" >> "$GITHUB_STEP_SUMMARY"
echo "| Residual Blocks | $RESIDUAL_BLOCKS |" >> "$GITHUB_STEP_SUMMARY"
echo "| Dataset | $DATASET ($SAMPLES samples) |" >> "$GITHUB_STEP_SUMMARY"
COMMIT_LINK="[\`${GITHUB_SHA::7}\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA})"
echo "| Commit | $COMMIT_LINK |" >> "$GITHUB_STEP_SUMMARY"
if [ -n "$WANDB_URL" ]; then
WANDB_RUN_ID=$(echo "$WANDB_URL" | grep -oP '[^/]+$')
echo "| WandB | [$WANDB_PROJECT](https://wandb.ai/PrinceOA/$WANDB_PROJECT) run [$WANDB_RUN_ID]($WANDB_URL) |" >> "$GITHUB_STEP_SUMMARY"
fi
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "### Results" >> "$GITHUB_STEP_SUMMARY"
echo "| Metric | Value |" >> "$GITHUB_STEP_SUMMARY"
echo "|--------|-------|" >> "$GITHUB_STEP_SUMMARY"
echo "| val_loss | $VAL_LOSS |" >> "$GITHUB_STEP_SUMMARY"
echo "| train_loss | $TRAIN_LOSS |" >> "$GITHUB_STEP_SUMMARY"
echo "| Wallclock | ${WALLCLOCK}s |" >> "$GITHUB_STEP_SUMMARY"
32 changes: 32 additions & 0 deletions .github/workflows/gpu-e2e-modal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: GPU E2E (Modal)

on:
pull_request:
branches: [main]
workflow_dispatch:
inputs:
epochs:
description: 'Number of training epochs'
default: '5'
type: string

jobs:
test:
runs-on: ubuntu-latest
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Modal
run: uv pip install --system modal

- name: Run e2e test on Modal GPU
env:
EPOCHS: ${{ inputs.epochs || '5' }}
run: modal run modal/ci.py --epochs "$EPOCHS"
Loading
Loading