Skip to content

Commit

Permalink
Dockerize TGG Unit Tests (#18189)
Browse files Browse the repository at this point in the history
### Ticket
#18188

### Problem description
This workflow was limited to the OS of the host machine.

### What's changed
Dockerized the workflow.

### Checklist
- [x] [All post
commit](https://github.com/tenstorrent/tt-metal/actions/workflows/all-post-commit-workflows.yaml)
CI
[passes](https://github.com/tenstorrent/tt-metal/actions/runs/13487539999)
- [x] TGG Unit Tests
[passes](https://github.com/tenstorrent/tt-metal/actions/runs/13488696140)
  • Loading branch information
afuller-TT authored Feb 24, 2025
1 parent c895538 commit d8837b6
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 13 deletions.
65 changes: 53 additions & 12 deletions .github/workflows/tgg-unit-tests-impl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: "[internal] TGG unit tests impl"

on:
workflow_call:
inputs:
docker-image:
required: true
type: string
wheel-artifact-name:
required: true
type: string

jobs:
TGG-tests:
Expand All @@ -17,26 +24,60 @@ jobs:
},
]
name: ${{ matrix.test-group.name }}
env:
ARCH_NAME: ${{ matrix.test-group.arch }}
LOGURU_LEVEL: INFO
LD_LIBRARY_PATH: ${{ github.workspace }}/build/lib
runs-on: ${{ matrix.test-group.runs-on }}
container:
image: ${{ inputs.docker-image }}
env:
TT_METAL_HOME: /work
PYTHONPATH: /work
LD_LIBRARY_PATH: /work/build/lib
LOGURU_LEVEL: INFO
ARCH_NAME: ${{ matrix.test-group.arch }}
volumes:
- ${{ github.workspace }}/docker-job:/work # Subdir to workaround https://github.com/actions/runner/issues/691
- /dev/hugepages-1G:/dev/hugepages-1G
- /mnt/MLPerf:/mnt/MLPerf
options: "--device /dev/tenstorrent"
defaults:
run:
shell: bash
working-directory: /work # https://github.com/actions/runner/issues/878
steps:
- uses: tenstorrent/tt-metal/.github/actions/checkout-with-submodule-lfs@main
- name: Set up dynamic env vars for build
run: |
echo "TT_METAL_HOME=$(pwd)" >> $GITHUB_ENV
- name: ⬇️ Checkout
uses: actions/checkout@v4
with:
submodules: recursive
path: docker-job # Here be dragons; keep it scoped to our desired volume, yet must be under github.workspace and be sure to clean up at the end
- uses: actions/download-artifact@v4
with:
name: TTMetal_build_any
path: /work
- name: Extract files
run: tar -xvf ttm_any.tar
- uses: ./.github/actions/install-python-deps
- name: ⬇️ Download Wheel
uses: actions/download-artifact@v4
with:
name: ${{ inputs.wheel-artifact-name }}
path: /work
- name: Install Wheel
run: |
WHEEL_FILENAME=$(ls -1 *.whl)
pip3 install $WHEEL_FILENAME
- name: Run unit regression tests
timeout-minutes: 60
run: |
source ${{ github.workspace }}/python_env/bin/activate
cd $TT_METAL_HOME
export PYTHONPATH=$TT_METAL_HOME
set -x
pwd
echo $PYTHONPATH
ls -al
${{ matrix.test-group.cmd }}
- name: Cleanup
if: always()
run: |
# We are forced to checkout the repo into a subdir of the host's workdir; this pollutes the host
# with root-owned files. Be sure to clean up after ourselves in case we're on a non-ephemeral runner.
echo "pre rm"
ls -al /__w/tt-metal/tt-metal
rm -rf /__w/tt-metal/tt-metal/docker-job
echo "post rm"
ls -al /__w/tt-metal/tt-metal
5 changes: 5 additions & 0 deletions .github/workflows/tgg-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ jobs:
build-artifact:
uses: ./.github/workflows/build-artifact.yaml
secrets: inherit
with:
build-wheel: true
TGG-tests:
needs: build-artifact
secrets: inherit
uses: ./.github/workflows/tgg-unit-tests-impl.yaml
with:
docker-image: ${{ needs.build-artifact.outputs.ci-build-docker-image }}
wheel-artifact-name: ${{ needs.build-artifact.outputs.wheel-artifact-name }}
8 changes: 7 additions & 1 deletion tests/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,13 @@ set_up_chdir() {
return
fi
done
echo "Could not find the 'tt-metal' directory in your PYTHONPATH." 1>&2
for ENTRY in "${ENTRIES[@]}"; do
if [[ -d "$ENTRY/tt_metal" ]]; then
cd "$ENTRY"
return
fi
done
echo "Could not find the 'tt-metal' directory in your PYTHONPATH." 1>&2
exit 1
}

Expand Down

0 comments on commit d8837b6

Please sign in to comment.