Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #227

Merged
merged 38 commits into from
Sep 17, 2024
Merged

Dev #227

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
cbfd407
added backup urls + added checksum verification for cmutil download
anandhu-eng Sep 12, 2024
8aeaa7f
handled downloads where checksum not provided
anandhu-eng Sep 12, 2024
bbe6021
Merge branch 'mlperf-inference' into enhancingDownloadFile
anandhu-eng Sep 12, 2024
26a3ffe
fixed checksum key in env+intentional url mistake
anandhu-eng Sep 12, 2024
4991192
test commit
anandhu-eng Sep 12, 2024
45f4eaf
testing-MACOS
anandhu-eng Sep 12, 2024
2913450
testing-MACOS
anandhu-eng Sep 12, 2024
0a83dc6
Merge branch 'mlperf-inference' into enhancingDownloadFile
anandhu-eng Sep 12, 2024
6ac0bdd
added changes from go-MACOS
anandhu-eng Sep 12, 2024
0ed597a
test commit - macos
anandhu-eng Sep 13, 2024
8335231
fix for macos - returncode diff for macos
anandhu-eng Sep 13, 2024
920d8ba
rmoved debug prints
anandhu-eng Sep 13, 2024
2482447
changed download tool from cmutil to wget
anandhu-eng Sep 13, 2024
1928cf0
commit to check gh action fails
anandhu-eng Sep 13, 2024
28aee42
reverting to hash 8335231
anandhu-eng Sep 13, 2024
717ab8a
reverted wgett
anandhu-eng Sep 13, 2024
da5a503
test commit
anandhu-eng Sep 13, 2024
9a46c32
modified dependency recursive
anandhu-eng Sep 13, 2024
192c20c
correcteed url
anandhu-eng Sep 13, 2024
1d585f9
Merge branch 'mlperf-inference' into enhancingDownloadFile
arjunsuresh Sep 13, 2024
579bbee
added _ to prevent checksum being used
anandhu-eng Sep 16, 2024
0f63b7d
Merge branch 'mlperf-inference' into enhancingDownloadFile
anandhu-eng Sep 16, 2024
ad88811
Merge pull request #112 from anandhu-eng/enhancingDownloadFile
arjunsuresh Sep 16, 2024
cc76c14
Merge branch 'mlcommons:mlperf-inference' into mlperf-inference
arjunsuresh Sep 16, 2024
4188129
Added python dependency
anandhu-eng Sep 17, 2024
e93151b
bug fix - handle incomplete download
anandhu-eng Sep 17, 2024
6a93ac6
Merge pull request #116 from anandhu-eng/cocoa-dataset-fix
arjunsuresh Sep 17, 2024
3fcc7d1
Merge branch 'mlperf-inference' into fix-kits-dataset
arjunsuresh Sep 17, 2024
6ab93e6
Merge pull request #115 from anandhu-eng/fix-kits-dataset
arjunsuresh Sep 17, 2024
2b7002b
Removed redundant run.bat for imagenet-aux
arjunsuresh Sep 17, 2024
a306195
Fix libffi name for macos
arjunsuresh Sep 17, 2024
40469a7
Improve the github actions, test broken links
arjunsuresh Sep 17, 2024
bbdf143
Improve the github actions, test broken links
arjunsuresh Sep 17, 2024
5939e67
Improve the github actions, test broken links
arjunsuresh Sep 17, 2024
1d88d29
Merge pull request #224 from GATEOverflow/mlperf-inference
arjunsuresh Sep 17, 2024
b0f6652
Merge branch 'dev' into mlperf-inference
arjunsuresh Sep 17, 2024
56d6fd6
Merge pull request #226 from mlcommons/mlperf-inference
arjunsuresh Sep 17, 2024
53ed49d
Merge branch 'main' into dev
arjunsuresh Sep 17, 2024
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
17 changes: 0 additions & 17 deletions .github/workflows/check-all-broken-links.md

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/test-cm-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ on:
jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
on: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.12", "3.9"]
runs-on: "${{ matrix.on }}"

steps:
- uses: actions/checkout@v3
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/test-mlperf-inference-resnet50.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: MLPerf inference resnet50
name: MLPerf inference ResNet50

on:
pull_request:
Expand All @@ -10,7 +10,6 @@ on:
- '.github/workflows/test-mlperf-inference-resnet50.yml'
- '**'
- '!**.md'

jobs:
build:
runs-on: ${{ matrix.os }}
Expand All @@ -33,7 +32,7 @@ jobs:
- os: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
Expand All @@ -44,4 +43,4 @@ jobs:
cm pull repo --url=${{ github.event.pull_request.head.repo.html_url }} --checkout=${{ github.event.pull_request.head.ref }}
- name: Test MLPerf Inference ResNet50
run: |
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --submitter="cTuning" --hw_name=default --model=resnet50 --implementation=${{ matrix.implementation }} --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=500 --target_qps=1 -v --quiet
cm run script --tags=run-mlperf,inference,_submission,_short --submitter="cTuning" --hw_name=default --model=resnet50 --implementation=${{ matrix.implementation }} --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=500 --target_qps=1 -v --quiet
100 changes: 76 additions & 24 deletions script/download-file/customize.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cmind import utils
import os
import hashlib
import subprocess

def preprocess(i):

Expand All @@ -20,6 +20,9 @@ def preprocess(i):

q = '"' if os_info['platform'] == 'windows' else "'"

x='*' if os_info['platform'] == 'windows' else ''
x_c='-s' if os_info['platform'] == 'darwin_off' else ''

if env.get('CM_DOWNLOAD_LOCAL_FILE_PATH'):
filepath = env['CM_DOWNLOAD_LOCAL_FILE_PATH']

Expand Down Expand Up @@ -80,39 +83,80 @@ def preprocess(i):

if tool == "cmutil":
print ('')
cmutil_require_download = 0
if env.get('CM_DOWNLOAD_CHECKSUM_FILE', '') != '':
checksum_cmd = f"cd {q}{filepath}{q} {xsep} md5sum -c{x_c} {x}{q}{env['CM_DOWNLOAD_CHECKSUM_FILE']}{q}"
checksum_result = subprocess.run(checksum_cmd, cwd=f'{q}{filepath}{q}', capture_output=True, text=True, shell=True)
elif env.get('CM_DOWNLOAD_CHECKSUM', '') != '':
checksum_cmd = f"echo {env.get('CM_DOWNLOAD_CHECKSUM')} {x}{q}{env['CM_DOWNLOAD_FILENAME']}{q} | md5sum -c{x_c} -"
checksum_result = subprocess.run(checksum_cmd, capture_output=True, text=True, shell=True)
if env.get('CM_DOWNLOAD_CHECKSUM_FILE', '') != '' or env.get('CM_DOWNLOAD_CHECKSUM', '') != '':
print(checksum_result) #for debugging
if "checksum did not match" in checksum_result.stderr.lower():
computed_checksum = subprocess.run(f"md5sum {env['CM_DOWNLOAD_FILENAME']}", capture_output=True, text=True, shell=True).stdout.split(" ")[0]
print(f"WARNING: File already present, mismatch between original checksum({env.get('CM_DOWNLOAD_CHECKSUM')}) and computed checksum({computed_checksum}). Deleting the already present file and downloading new.")
try:
os.remove(env['CM_DOWNLOAD_FILENAME'])
print(f"File {env['CM_DOWNLOAD_FILENAME']} deleted successfully.")
except PermissionError:
return {"return":1, "error":f"Permission denied to delete file {env['CM_DOWNLOAD_FILENAME']}."}
cmutil_require_download = 1
elif "no such file" in checksum_result.stderr.lower():
print(f"No file {env['CM_DOWNLOAD_FILENAME']}. Downloading through cmutil.")
cmutil_require_download = 1
else:
print(f"WARNING: File {env['CM_DOWNLOAD_FILENAME']} already present, original checksum and computed checksum matches! Skipping Download..")
else:
cmutil_require_download = 1

if cmutil_require_download == 1:
cm = automation.cmind
for i in range(1,5):
r = cm.access({'action':'download_file',
'automation':'utils,dc2743f8450541e3',
'url':url,
'verify': verify_ssl})
if r['return'] == 0: break
oldurl = url
url = env.get('CM_DOWNLOAD_URL'+str(i),'')
if url == '':
break
print(f"Download from {oldurl} failed, trying from {url}")

if r['return']>0: return r

env['CM_DOWNLOAD_CMD'] = ""
env['CM_DOWNLOAD_FILENAME'] = r['filename']

cm = automation.cmind
elif tool == "wget":
if env.get('CM_DOWNLOAD_FILENAME', '') != '':
extra_download_options +=f" --tries=3 -O {q}{env['CM_DOWNLOAD_FILENAME']}{q} "
env['CM_DOWNLOAD_CMD'] = f"wget -nc {extra_download_options} {url}"
for i in range(1,5):
r = cm.access({'action':'download_file',
'automation':'utils,dc2743f8450541e3',
'url':url,
'verify': verify_ssl})
if r['return'] == 0: break
oldurl = url
url = env.get('CM_DOWNLOAD_URL'+str(i),'')
if url == '':
break
print(f"Download from {oldurl} failed, trying from {url}")

if r['return']>0: return r

env['CM_DOWNLOAD_CMD'] = ""
env['CM_DOWNLOAD_FILENAME'] = r['filename']

elif tool == "wget":
if env.get('CM_DOWNLOAD_FILENAME', '') != '':
extra_download_options +=f" -O {q}{env['CM_DOWNLOAD_FILENAME']}{q} "
env['CM_DOWNLOAD_CMD'] = f"wget -nc {extra_download_options} {url}"
env['CM_DOWNLOAD_CMD'] += f" || ((rm -f {env['CM_DOWNLOAD_FILENAME']} || true) && wget -nc {extra_download_options} {url})"

elif tool == "curl":
if env.get('CM_DOWNLOAD_FILENAME', '') != '':
extra_download_options +=f" --output {q}{env['CM_DOWNLOAD_FILENAME']}{q} "

env['CM_DOWNLOAD_CMD'] = f"curl {extra_download_options} {url}"
for i in range(1,5):
url = env.get('CM_DOWNLOAD_URL'+str(i),'')
if url == '':
break
env['CM_DOWNLOAD_CMD'] += f" || ((rm -f {env['CM_DOWNLOAD_FILENAME']} || true) && curl {extra_download_options} {url})"


elif tool == "gdown":
env['CM_DOWNLOAD_CMD'] = f"gdown {extra_download_options} {url}"
for i in range(1,5):
url = env.get('CM_DOWNLOAD_URL'+str(i),'')
if url == '':
break
env['CM_DOWNLOAD_CMD'] += f" || ((rm -f {env['CM_DOWNLOAD_FILENAME']} || true) && gdown {extra_download_options} {url})"

elif tool == "rclone":
if env.get('CM_RCLONE_CONFIG_CMD', '') != '':
Expand All @@ -127,6 +171,16 @@ def preprocess(i):
env['CM_DOWNLOAD_CMD'] = f"rclone {rclone_copy_using} {q}{url}{q} {q}{os.path.join(os.getcwd(), temp_download_file)}{q} -P"
else:
env['CM_DOWNLOAD_CMD'] = f"rclone {rclone_copy_using} {q}{url}{q} {q}{os.path.join(os.getcwd(), env['CM_DOWNLOAD_FILENAME'])}{q} -P"
for i in range(1,5):
url = env.get('CM_DOWNLOAD_URL'+str(i),'')
if url == '':
break
if env["CM_HOST_OS_TYPE"] == "windows":
url = url.replace("%", "%%")
temp_download_file = env['CM_DOWNLOAD_FILENAME'].replace("%", "%%")
env['CM_DOWNLOAD_CMD'] = f" || ((rm -f {env['CM_DOWNLOAD_FILENAME']} || true) && rclone {rclone_copy_using} {q}{url}{q} {q}{os.path.join(os.getcwd(), temp_download_file)}{q} -P)"
else:
env['CM_DOWNLOAD_CMD'] = f" || ((rm -f {env['CM_DOWNLOAD_FILENAME']} || true) && rclone {rclone_copy_using} {q}{url}{q} {q}{os.path.join(os.getcwd(), env['CM_DOWNLOAD_FILENAME'])}{q} -P"

filename = env['CM_DOWNLOAD_FILENAME']
env['CM_DOWNLOAD_DOWNLOADED_FILENAME'] = filename
Expand All @@ -136,13 +190,11 @@ def preprocess(i):

env['CM_DOWNLOAD_DOWNLOADED_PATH'] = filepath

x='*' if os_info['platform'] == 'windows' else ''
x_c=' -s ' if os_info['platform'] == 'darwin_off' else '' #not using this option for now
#verify checksum if file already present
# verify checksum if file already present
if env.get('CM_DOWNLOAD_CHECKSUM_FILE', '') != '':
env['CM_DOWNLOAD_CHECKSUM_CMD'] = f"cd {q}{filepath}{q} {xsep} md5sum -c{x_c} {x}{q}{env['CM_DOWNLOAD_CHECKSUM_FILE']}{q}"
env['CM_DOWNLOAD_CHECKSUM_CMD'] = f"cd {q}{filepath}{q} {xsep} md5sum -c {x_c} {x}{q}{env['CM_DOWNLOAD_CHECKSUM_FILE']}{q}"
elif env.get('CM_DOWNLOAD_CHECKSUM', '') != '':
env['CM_DOWNLOAD_CHECKSUM_CMD'] = "echo {} {}{}{}{} | md5sum {}-c -".format(env.get('CM_DOWNLOAD_CHECKSUM'), x, q, env['CM_DOWNLOAD_FILENAME'], q, x_c)
env['CM_DOWNLOAD_CHECKSUM_CMD'] = "echo {} {}{}{}{} | md5sum {} -c -".format(env.get('CM_DOWNLOAD_CHECKSUM'), x, q, env['CM_DOWNLOAD_FILENAME'], q, x_c)
else:
env['CM_DOWNLOAD_CHECKSUM_CMD'] = ""

Expand Down
7 changes: 7 additions & 0 deletions script/get-dataset-coco2014/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ if [[ ${CM_DATASET_CALIBRATION} == "no" ]]; then
else
max_images=""
fi

# deleting existing incomplete downloads if any
if [ -f "${INSTALL_DIR}/download_aux/annotations_trainval2014.zip" ]; then
echo "File annotations_trainval2014.zip already exists. Deleting it."
rm ${INSTALL_DIR}/download_aux/annotations_trainval2014.zip
fi

cmd="./download-coco-2014.sh -d ${INSTALL_DIR} ${max_images}"
echo $cmd
eval $cmd
Expand Down
16 changes: 0 additions & 16 deletions script/get-dataset-imagenet-aux/run.bat

This file was deleted.

7 changes: 7 additions & 0 deletions script/get-dataset-kits19/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"deps": [
{
"tags": "detect,os"
},
{
"names": [
"python3",
"python"
],
"tags": "get,python3"
}
],
"new_env_keys": [
Expand Down
2 changes: 1 addition & 1 deletion script/get-generic-sys-util/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
"state": {
"libffi_dev": {
"apt": "libffi-dev",
"brew": "libffi-dev",
"brew": "libffi",
"dnf": "libffi-devel",
"yum": "libffi-devel"
}
Expand Down
Loading