Skip to content

Add Weekly job for model analysis #9

Add Weekly job for model analysis

Add Weekly job for model analysis #9

name: Model Analysis Weekly
on:
workflow_dispatch:
# schedule:
# - cron: '0 23 * * 5' # 11:00 PM UTC Friday (12:00 AM Saturday Serbia)
push:
branches: ["pchandrasekaran/model_analysis_weekly_job"]
jobs:
build-image:
runs-on: builder
outputs:
docker-image: ${{ steps.build.outputs.docker-image }}
steps:
- name: Fix permissions
shell: bash
run: sudo chown ubuntu:ubuntu -R $(pwd)
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Fetch all history and tags
# Clean everything from submodules (needed to avoid issues
# with cmake generated files leftover from previous builds)
- name: Cleanup submodules
run: |
git submodule foreach --recursive git clean -ffdx
git submodule foreach --recursive git reset --hard
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker images and output the image name
id: build
shell: bash
run: |
# Output the image name
set pipefail
.github/build-docker-images.sh | tee docker.log
DOCKER_CI_IMAGE=$(tail -n 1 docker.log)
echo "DOCKER_CI_IMAGE $DOCKER_CI_IMAGE"
echo "docker-image=$DOCKER_CI_IMAGE" >> "$GITHUB_OUTPUT"
model-analysis:
needs: build-image
runs-on: in-service
container:
image: ${{ needs.build-image.outputs.docker-image }}
options: --device /dev/tenstorrent/0
volumes:
- /dev/hugepages:/dev/hugepages
- /dev/hugepages-1G:/dev/hugepages-1G
- /etc/udev/rules.d:/etc/udev/rules.d
- /lib/modules:/lib/modules
- /opt/tt_metal_infra/provisioning/provisioning_env:/opt/tt_metal_infra/provisioning/provisioning_env
steps:
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Fetch all history and tags
# Clean everything from submodules (needed to avoid issues
# with cmake generated files leftover from previous builds)
- name: Cleanup submodules
run: |
git submodule foreach --recursive git clean -ffdx
git submodule foreach --recursive git reset --hard
# - name: ccache
# uses: hendrikmuhs/[email protected]
# with:
# create-symlink: true
# key: model-analysis-${{ runner.os }}
# - name: Build
# shell: bash
# run: |
# source env/activate
# cmake -G Ninja \
# -B ${{ steps.strings.outputs.build-output-dir }} \
# -DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_C_COMPILER=clang \
# -DCMAKE_CXX_COMPILER=clang++ \
# -DCMAKE_C_COMPILER_LAUNCHER=ccache \
# -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
# cmake --build ${{ steps.strings.outputs.build-output-dir }}
# - name: Run Model Analysis Script
# shell: bash
# run: |
# source env/activate
# apt install -y libgl1-mesa-glx
# python scripts/model_analysis.py \
# --test_directory_or_file_path forge/test/models/pytorch \
# --dump_failure_logs \
# --markdown_directory_path ./model_analysis_docs \
# --unique_ops_output_directory_path ./models_unique_ops_output \
# 2>&1 | tee model_analysis.log
# - name: Upload Model Analysis Script Logs
# uses: actions/upload-artifact@v4
# if: success() || failure()
# with:
# name: model-analysis-outputs
# path: model_analysis.log
# - name: Upload Models Unique Ops test Failure Logs
# uses: actions/upload-artifact@v4
# if: success() || failure()
# with:
# name: unique-ops-logs
# path: ./models_unique_ops_output
# - name: Create Pull Request
# uses: peter-evans/create-pull-request@v7
# with:
# branch: model_analysis
# committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
# base: main
# commit-message: "Update model analysis docs"
# title: "Update model analysis docs"
# body: "This PR will update model analysis docs"
# labels: model_analysis
# delete-branch: true
# token: ${{ secrets.GH_TOKEN }}
# add-paths: |
# model_analysis_docs/
# draft: true # Need to remove