Skip to content

Commit 67324b8

Browse files
authored
Merge branch 'master' into master
2 parents 959b8ed + 35c7e1f commit 67324b8

File tree

342 files changed

+32757
-17536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+32757
-17536
lines changed

.github/scripts/format-cpp.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#================================================================
2+
# HEADER
3+
#================================================================
4+
# DESCRIPTION
5+
# This is a script containing some commands to automatically
6+
# format the c/c++ code contained in one folder.
7+
# This will help to maintain good quality code in the github
8+
# repository.
9+
# SET UP
10+
# You need to allow the correct permissions for this file.
11+
# This can be done by running:
12+
# chmod u+x <path to file>
13+
# REQUIREMENTS
14+
# clang-format
15+
#================================================================
16+
# END_OF_HEADER
17+
#================================================================
18+
19+
20+
# Checks all the modified c/c++ files, format them and adds them
21+
# to the commit.
22+
for FILE in $(git diff $1/$2 --name-only | grep -E '.*\.(cc|cpp|h|hpp)$')
23+
do
24+
clang-format -i -style=file $FILE
25+
git add $FILE
26+
done

.github/scripts/format-py.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#================================================================
2+
# HEADER
3+
#================================================================
4+
# DESCRIPTION
5+
# This is a script containing some commands to automatically
6+
# format the c/c++ code contained in one folder.
7+
# This will help to maintain good quality code in the github
8+
# repository.
9+
# SET UP
10+
# You need to allow the correct permissions for this file.
11+
# This can be done by running:
12+
# chmod u+x <path to file>
13+
# REQUIREMENTS
14+
# clang-format
15+
#================================================================
16+
# END_OF_HEADER
17+
#================================================================
18+
19+
20+
# Checks all the modified c/c++ files, format them and adds them
21+
# to the commit.
22+
for FILE in $(git diff $1/$2 --name-only | grep -E '.*\.py$')
23+
do
24+
autopep8 --in-place -a $FILE
25+
git add $FILE
26+
done

.github/workflows/build_wheels.yml

Lines changed: 101 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,75 @@ on:
66
push:
77
branches:
88
- master
9+
- loadgen-release
10+
- dev
911
paths:
10-
- loadgen/setup.py
12+
- loadgen/**
1113

1214
jobs:
15+
update_version:
16+
name: Update version only on ubuntu but used by windows and macos
17+
if: github.repository_owner == 'mlcommons'
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 2
23+
ssh-key: ${{ secrets.DEPLOY_KEY }}
24+
25+
# Check if VERSION.txt file has changed in this push
26+
- name: Check if VERSION.txt file has changed
27+
id: version_changed
28+
run: |
29+
echo "version_changed=false" >> $GITHUB_ENV
30+
echo "new_version=" >> $GITHUB_ENV # Initialize with empty value
31+
if git diff --name-only HEAD~1 | grep -q "VERSION.txt"; then
32+
echo "VERSION.txt file has been modified"
33+
echo "version_changed=true" >> $GITHUB_ENV
34+
new_version=$(cat loadgen/VERSION.txt)
35+
echo "new_version=$new_version" >> $GITHUB_ENV
36+
else
37+
echo "VERSION.txt file has NOT been modified"
38+
fi
39+
40+
# Step 4: Increment version if VERSION.txt was not changed
41+
- name: Increment version if necessary
42+
id: do_version_increment
43+
if: env.version_changed == 'false'
44+
run: |
45+
cd loadgen
46+
# Check if VERSION file exists, else initialize it
47+
if [ ! -f VERSION.txt ]; then
48+
echo "0.0.0" > VERSION.txt
49+
fi
50+
51+
version=$(cat VERSION.txt)
52+
IFS='.' read -r major minor patch <<< "$version"
53+
patch=$((patch + 1))
54+
new_version="$major.$minor.$patch"
55+
echo $new_version > VERSION.txt
56+
echo "New version: $new_version"
57+
echo "new_version=$new_version" >> $GITHUB_ENV
58+
59+
# Step 5: Commit the updated version to the repository
60+
- name: Commit updated version
61+
if: env.version_changed == 'false'
62+
run: |
63+
cd loadgen
64+
git config --global user.name "${{ github.actor }}"
65+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
66+
git add VERSION.txt
67+
git commit -m "Increment version to $new_version"
68+
git push
69+
1370
build_wheels:
1471
name: Build wheels on ${{ matrix.os }}
72+
needs: update_version
1573
runs-on: ${{ matrix.os }}
1674
strategy:
1775
fail-fast: false
1876
matrix:
19-
os: [ubuntu-latest, windows-latest, macOS-latest]
77+
os: [ubuntu-latest, windows-latest, macos-latest]
2078

2179
steps:
2280
- uses: actions/checkout@v3
@@ -27,12 +85,48 @@ jobs:
2785
run: python -m pip install cibuildwheel twine
2886

2987
- name: Build wheels
30-
run: python -m cibuildwheel loadgen/ --output-dir wheels
88+
run: git pull && python -m cibuildwheel loadgen/ --output-dir wheels
3189

32-
- uses: actions/upload-artifact@v3
90+
# Save wheels as artifacts
91+
- name: Upload built wheels
92+
uses: actions/upload-artifact@v4
3393
with:
34-
path: ./wheels/*.whl
94+
name: wheels-${{ matrix.os }}
95+
path: wheels
3596

36-
- name: Publish package to PyPI
37-
run: python -m twine upload wheels/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
97+
publish_wheels:
98+
needs: build_wheels # Wait for the build_wheels job to complete
99+
runs-on: ubuntu-latest # Only run this job on Linux
100+
environment: release
101+
permissions:
102+
# IMPORTANT: this permission is mandatory for trusted publishing
103+
id-token: write
104+
steps:
105+
- uses: actions/checkout@v3
38106

107+
# Download the built wheels from ubuntu
108+
- name: Download Ubuntu wheels
109+
uses: actions/download-artifact@v4
110+
with:
111+
name: wheels-ubuntu-latest
112+
path: wheels
113+
# Download the built wheels from macOS
114+
- name: Download macOS wheels
115+
uses: actions/download-artifact@v4
116+
with:
117+
name: wheels-macos-latest
118+
path: wheels
119+
# Download the built wheels from Windows
120+
- name: Download Windows wheels
121+
uses: actions/download-artifact@v4
122+
with:
123+
name: wheels-windows-latest
124+
path: wheels
125+
- name: Publish
126+
uses: pypa/gh-action-pypi-publish@release/v1
127+
with:
128+
verify-metadata: true
129+
skip-existing: true
130+
packages-dir: wheels
131+
repository-url: https://upload.pypi.org/legacy/
132+
verbose: true

.github/workflows/cla.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
jobs:
1010
cla-check:
11+
if: github.repository_owner == 'mlcommons'
1112
runs-on: ubuntu-latest
1213
steps:
1314
- name: "MLCommons CLA bot check"

.github/workflows/format.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Automatic code formatting
2+
name: "format"
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
types: [opened, closed, synchronize]
7+
8+
9+
env:
10+
python_version: "3.9"
11+
HEAD_REF: ${{ github.head_ref }}
12+
13+
jobs:
14+
format-code:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
- name: Set up Python ${{ env.python_version }}
21+
uses: actions/setup-python@v3
22+
with:
23+
python-version: ${{ env.python_version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python3 -m pip install autopep8
28+
29+
- name: Grant permissions
30+
run: |
31+
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/format-cpp.sh"
32+
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/format-py.sh"
33+
34+
- name: Format Codebase
35+
run: |
36+
git remote add upstream ${{ github.event.pull_request.base.repo.clone_url }}
37+
git fetch upstream ${{ github.event.pull_request.base.ref }}
38+
".github/scripts/format-cpp.sh" "upstream" "${{ github.event.pull_request.base.ref }}"
39+
".github/scripts/format-py.sh" "upstream" "${{ github.event.pull_request.base.ref }}"
40+
41+
- name: Commit
42+
run: |
43+
HAS_CHANGES=$(git diff --staged --name-only)
44+
if [ ${#HAS_CHANGES} -gt 0 ]; then
45+
git checkout -B "$HEAD_REF"
46+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
47+
git config --global user.name "${{ github.actor }}"
48+
git commit -m '[Automated Commit] Format Codebase'
49+
git push origin "$HEAD_REF"
50+
fi

.github/workflows/test-bert.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- .github/workflows/test-bert.yml
1313
- '!**.md'
1414

15+
env:
16+
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
17+
1518
jobs:
1619
build:
1720

@@ -33,4 +36,4 @@ jobs:
3336
python3 -m pip install cm4mlops
3437
- name: Test BERT and end to end submission generation
3538
run: |
36-
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=bert-99 --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.${{ github.event.pull_request.head.ref }}
39+
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=bert-99 --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.$PR_HEAD_REF --adr.loadgen.version=custom

.github/workflows/test-loadgen.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ on:
1111
- .github/workflows/test-loadgen.yml
1212
- '!**.md'
1313

14+
env:
15+
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
16+
1417
jobs:
1518
build:
1619

1720
runs-on: ubuntu-latest
1821
strategy:
1922
fail-fast: false
2023
matrix:
21-
python-version: ["3.8", "3.9", "3.10"]
24+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
2225

2326
steps:
2427
- uses: actions/checkout@v3
@@ -31,4 +34,4 @@ jobs:
3134
python3 -m pip install cm4mlops
3235
- name: Test Loadgen
3336
run: |
34-
cm run script --tags=get,mlperf,inference,loadgen --quiet --version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.${{ github.event.pull_request.head.ref }}
37+
cm run script --tags=get,mlperf,inference,loadgen --quiet --version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.$PR_HEAD_REF --adr.loadgen.tags=_no-compilation-warnings

.github/workflows/test-resnet50.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ on:
88
branches: [ "master", "dev" ]
99
paths:
1010
- vision/classification_and_detection/**
11+
- loadgen/**
1112
- tools/submission/**
1213
- .github/workflows/test-resnet50.yml
1314
- '!**.md'
1415

16+
env:
17+
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
18+
1519
jobs:
1620
build:
1721

@@ -21,6 +25,7 @@ jobs:
2125
matrix:
2226
python-version: [ "3.9" ]
2327
backend: [ "onnxruntime", "tf" ]
28+
loadgen-flag: [ "", "--adr.loadgen.tags=_from-pip --pip_loadgen=yes" ]
2429

2530
steps:
2631
- uses: actions/checkout@v3
@@ -33,4 +38,4 @@ jobs:
3338
python3 -m pip install cm4mlops
3439
- name: Test Resnet50 and end to end submission generation
3540
run: |
36-
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=resnet50 --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=500 --adr.compiler.tags=gcc --adr.inference-src.tags=_branch.${{ github.event.pull_request.head.ref }},_repo.${{ github.event.pull_request.head.repo.html_url }} --adr.inference-src.version=custom
41+
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=resnet50 --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=500 --adr.compiler.tags=gcc --adr.inference-src.tags=_branch.$PR_HEAD_REF,_repo.${{ github.event.pull_request.head.repo.html_url }} --adr.inference-src.version=custom --adr.loadgen.version=custom ${{ matrix.loadgen-flag }}

.github/workflows/test-retinanet.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- .github/workflows/test-retinanet.yml
1313
- '!**.md'
1414

15+
env:
16+
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
17+
1518
jobs:
1619
build:
1720

@@ -33,4 +36,4 @@ jobs:
3336
python3 -m pip install cm4mlops
3437
- name: Test Retinanet and end to end submission generation
3538
run: |
36-
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=retinanet --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=10 --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.${{ github.event.pull_request.head.ref }}
39+
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=retinanet --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=10 --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.$PR_HEAD_REF --adr.loadgen.version=custom

.github/workflows/test-rnnt.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- .github/workflows/test-rnnt.yml
1313
- '!**.md'
1414

15+
env:
16+
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
17+
1518
jobs:
1619
build:
1720

@@ -36,4 +39,4 @@ jobs:
3639
cm run script --quiet --tags=get,sys-utils-cm
3740
- name: Test RNNT and end to end submission generation
3841
run: |
39-
cm run script --tags=run,mlperf,inference,generate-run-cmds,_performance-only --quiet --submitter="MLCommons" --hw_name=default --model=rnnt --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --precision=${{ matrix.precision }} --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.env.CM_GIT_CHECKOUT=${{ github.event.pull_request.head.ref }} --adr.inference-src.env.CM_GIT_URL=${{ github.event.pull_request.head.repo.html_url }} --adr.ml-engine-pytorch.version=1.13.0 --adr.ml-engine-torchvision.version=0.14.1 --adr.librosa.version_max=0.9.1
42+
cm run script --tags=run,mlperf,inference,generate-run-cmds,_performance-only --quiet --submitter="MLCommons" --hw_name=default --model=rnnt --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --precision=${{ matrix.precision }} --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.env.CM_GIT_CHECKOUT=$PR_HEAD_REF --adr.inference-src.env.CM_GIT_URL=${{ github.event.pull_request.head.repo.html_url }} --adr.ml-engine-pytorch.version=1.13.0 --adr.ml-engine-torchvision.version=0.14.1 --adr.librosa.version_max=0.9.1

0 commit comments

Comments
 (0)