Skip to content

Commit

Permalink
Merge pull request #413 from GATEOverflow/mlperf-inference
Browse files Browse the repository at this point in the history
Improve the benchmark-program-mlperf run command
  • Loading branch information
arjunsuresh authored Oct 23, 2024
2 parents dbb9d43 + f35509a commit 77882c5
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 22 deletions.
49 changes: 27 additions & 22 deletions script/benchmark-program-mlperf/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,34 @@ def postprocess(i):

if os_info['platform'] != 'windows':
# Construct the shell command with proper escaping
env['CM_MLPERF_RUN_CMD'] = (
"CM_MLPERF_RUN_COUNT=$(cat ${CM_RUN_DIR}/count.txt); "
"echo ${CM_MLPERF_RUN_COUNT}; "
"CM_MLPERF_RUN_COUNT=$((CM_MLPERF_RUN_COUNT+1)); "
"echo ${CM_MLPERF_RUN_COUNT} > ${CM_RUN_DIR}/count.txt && "
"if [ ${CM_MLPERF_RUN_COUNT} -eq 1 ]; then "
"export CM_MLPERF_USER_CONF=${CM_MLPERF_RANGING_USER_CONF}; "
"else "
"export CM_MLPERF_USER_CONF=${CM_MLPERF_TESTING_USER_CONF}; "
"fi && " + env.get('CM_RUN_CMD', '').strip()
)
env['CM_MLPERF_RUN_CMD'] = r"""
CM_MLPERF_RUN_COUNT=\$(cat \${CM_RUN_DIR}/count.txt);
echo \${CM_MLPERF_RUN_COUNT};
CM_MLPERF_RUN_COUNT=\$((CM_MLPERF_RUN_COUNT+1));
echo \${CM_MLPERF_RUN_COUNT} > \${CM_RUN_DIR}/count.txt &&
if [ \${CM_MLPERF_RUN_COUNT} -eq 1 ]; then
export CM_MLPERF_USER_CONF="${CM_MLPERF_RANGING_USER_CONF}";
else
export CM_MLPERF_USER_CONF="${CM_MLPERF_TESTING_USER_CONF}";
fi &&
""" + env.get('CM_RUN_CMD', '').strip()
else:
env['CM_MLPERF_RUN_CMD'] = (
"set /P CM_MLPERF_RUN_COUNT=<\"%CM_RUN_DIR%\\count.txt\" & "
"echo %CM_MLPERF_RUN_COUNT% & "
"set /A CM_MLPERF_RUN_COUNT=!CM_MLPERF_RUN_COUNT!+1 & "
"echo !CM_MLPERF_RUN_COUNT! > \"%CM_RUN_DIR%\\count.txt\" & "
"if !CM_MLPERF_RUN_COUNT! EQU 1 ( "
"set CM_MLPERF_USER_CONF=%CM_MLPERF_RANGING_USER_CONF% "
") else ( "
"set CM_MLPERF_USER_CONF=%CM_MLPERF_TESTING_USER_CONF% "
") & " + env.get('CM_RUN_CMD', '').strip()
)
env['CM_MLPERF_RUN_CMD'] = r"""
:: Read the current count from the file
set /p CM_MLPERF_RUN_COUNT=<%CM_RUN_DIR%\count.txt
echo !CM_MLPERF_RUN_COUNT!
:: Increment the count
set /a CM_MLPERF_RUN_COUNT=!CM_MLPERF_RUN_COUNT! + 1
echo !CM_MLPERF_RUN_COUNT! > %CM_RUN_DIR%\count.txt
:: Check the value and set the environment variable accordingly
if !CM_MLPERF_RUN_COUNT! EQU 1 (
set CM_MLPERF_USER_CONF=%CM_MLPERF_RANGING_USER_CONF%
) else (
set CM_MLPERF_USER_CONF=%CM_MLPERF_TESTING_USER_CONF%
)
""" + env.get('CM_RUN_CMD', '').strip()
else:
# Just use the existing CM_RUN_CMD if no ranging run is needed
env['CM_MLPERF_RUN_CMD'] = env.get('CM_RUN_CMD', '').strip()
Expand Down
15 changes: 15 additions & 0 deletions script/get-generic-sys-util/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,21 @@
}
}
},
"vim-common": {
"env": {
"CM_SYS_UTIL_NAME": "vim_common",
"CM_SYS_UTIL_CHECK_CMD": "xxd --version"
},
"state": {
"vim_common": {
"apt": "vim-common",
"brew": "vim",
"dnf": "vim-common",
"yum": "vim-common",
"choco": "vim"
}
}
},
"xz": {
"env": {
"CM_SYS_UTIL_NAME": "xz"
Expand Down

0 comments on commit 77882c5

Please sign in to comment.