Skip to content

Commit 4d5265a

Browse files
authored
Merge pull request #588 from mlcommons/mlperf-inference
Sync main <- Mlperf inference for November 2024 release
2 parents b62a227 + 6eefe2f commit 4d5265a

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

.github/workflows/test-cm-based-submission-generation.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,29 @@ jobs:
1919
python-version: [ "3.12" ]
2020
division: ["closed", "open", "closed-open"]
2121
category: ["datacenter", "edge"]
22-
case: ["closed", "closed-no-compliance", "closed-power", "closed-failed-power-logs", "case-3", "case-7", "case-8"]
22+
case: ["closed", "closed-no-compliance", "closed-power", "closed-failed-power-logs", "case-1", "case-2", "case-3", "case-5", "case-6", "case-7", "case-8"]
2323
action: ["run", "docker"]
2424
exclude:
2525
- os: macos-latest
2626
- os: windows-latest
2727
- category: "edge"
28+
- case: case-1
29+
division: closed
30+
- case: case-1
31+
division: closed-open
32+
- case: case-2
33+
division: closed
34+
- case: case-2
35+
division: closed-open
36+
- case: case-5
37+
division: closed
38+
- case: case-5
39+
division: closed-open
40+
- case: case-6
41+
division: closed
42+
- case: case-6
43+
division: closed-open
44+
2845
steps:
2946
- uses: actions/checkout@v4
3047
- name: Set up Python ${{ matrix.python-version }}
@@ -39,6 +56,7 @@ jobs:
3956
run: |
4057
git clone -b submission-generation-tests https://github.com/mlcommons/inference.git submission_generation_tests
4158
- name: Run Submission Generation - ${{ matrix.case }} ${{ matrix.action }} ${{ matrix.category }} ${{ matrix.division }}
59+
continue-on-error: true
4260
run: |
4361
if [ "${{ matrix.case }}" == "case-3" ]; then
4462
description="Submission generation (model_mapping.json not present but model name matches with official one)"
@@ -63,5 +81,18 @@ jobs:
6381
# Dynamically set the log group to simulate a dynamic step name
6482
echo "::group::$description"
6583
cm ${{ matrix.action }} script --tags=generate,inference,submission --adr.submission-checker-src.tags=_branch.dev --clean --preprocess_submission=yes --results_dir=$PWD/submission_generation_tests/${{ matrix.case }}/ --run-checker --submitter=MLCommons --tar=yes --env.CM_TAR_OUTFILE=submission.tar.gz --division=${{ matrix.division }} --env.CM_DETERMINE_MEMORY_CONFIGURATION=yes --quiet $extra_run_args
84+
exit_status=$?
85+
echo "Exit status for the job ${description} ${exit_status}"
86+
if [[ "${{ matrix.case }}" == "case-5" || "${{ matrix.case }}" == "case-6" ]]; then
87+
# For cases 5 and 6, exit status should be 0 if cm command fails, 1 if it succeeds
88+
if [[ ${exit_status} -ne 0 ]]; then
89+
exit 0
90+
else
91+
exit ${exit_status}
92+
fi
93+
else
94+
# For other cases, exit with the original status
95+
test ${exit_status} -eq 0 || exit ${exit_status}
96+
fi
6697
echo "::endgroup::"
6798

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.0
1+
0.4.1

script/generate-mlperf-inference-submission/_cm.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ input_mapping:
8383
submitter: CM_MLPERF_SUBMITTER
8484
sw_notes_extra: CM_MLPERF_SUT_SW_NOTES_EXTRA
8585
tar: CM_TAR_SUBMISSION_DIR
86+
get_platform_details: CM_GET_PLATFORM_DETAILS
8687
post_deps:
8788
- enable_if_env:
8889
CM_RUN_MLPERF_ACCURACY:

script/generate-mlperf-inference-submission/customize.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def generate_submission(env, state, inp, submission_division):
240240
compliance_path = os.path.join(path_submission, "compliance", sub_res)
241241
system_path = os.path.join(path_submission, "systems")
242242
submission_system_path = system_path
243+
243244
if not os.path.isdir(submission_system_path):
244245
os.makedirs(submission_system_path)
245246
system_file = os.path.join(submission_system_path, sub_res+".json")
@@ -273,6 +274,8 @@ def generate_submission(env, state, inp, submission_division):
273274

274275
print('* MLPerf inference model: {}'.format(model))
275276
for scenario in scenarios:
277+
# the system_info.txt is copied from the mode directory if found, else it would be looked under scenario directory
278+
system_info_from_mode = False
276279
results[model][scenario] = {}
277280
result_scenario_path = os.path.join(result_model_path, scenario)
278281
submission_scenario_path = os.path.join(submission_model_path, scenario)
@@ -429,6 +432,8 @@ def generate_submission(env, state, inp, submission_division):
429432
elif f in [ "README.md", "README-extra.md", "cm-version-info.json", "os_info.json", "cpu_info.json", "pip_freeze.json", "system_info.txt", "cm-deps.png", "cm-deps.mmd" ] and mode == "performance":
430433
shutil.copy(os.path.join(result_mode_path, f), os.path.join(submission_measurement_path, f))
431434
if f == "system_info.txt" and not platform_info_file:
435+
# the first found system_info.txt will be taken as platform info file for a specific model to be placed in
436+
# measurements-model folder when generating the final submission
432437
platform_info_file = os.path.join(result_mode_path, f)
433438
elif f in [ "console.out" ]:
434439
shutil.copy(os.path.join(result_mode_path, f), os.path.join(submission_measurement_path, mode+"_"+f))
@@ -445,6 +450,9 @@ def generate_submission(env, state, inp, submission_division):
445450
p_target = os.path.join(submission_results_path, f)
446451
shutil.copy(os.path.join(result_mode_path, f), p_target)
447452

453+
if os.path.exists(os.path.join(result_scenario_path, "system_info.txt")):
454+
shutil.copy(os.path.join(result_scenario_path, "system_info.txt"), os.path.join(submission_measurement_path, f))
455+
platform_info_file = os.path.join(result_scenario_path, "system_info.txt")
448456

449457
readme_file = os.path.join(submission_measurement_path, "README.md")
450458
if not os.path.exists(readme_file):
@@ -459,24 +467,39 @@ def generate_submission(env, state, inp, submission_division):
459467
with open(readme_file, mode='a') as f:
460468
f.write(result_string)
461469

462-
#Copy system_info.txt to the submission measurements model folder if any scenario performance run has it
470+
# Copy system_info.txt to the submission measurements model folder if any scenario performance run has it
463471
sys_info_file = None
472+
464473
if os.path.exists(os.path.join(result_model_path, "system_info.txt")):
465474
sys_info_file = os.path.join(result_model_path, "system_info.txt")
466475
elif platform_info_file:
467476
sys_info_file = platform_info_file
477+
468478
if sys_info_file:
469479
model_platform_info_file = sys_info_file
470480
shutil.copy(sys_info_file, os.path.join(measurement_model_path, "system_info.txt"))
471481

472482
#Copy system_info.txt to the submission measurements folder if any model performance run has it
473483
sys_info_file = None
484+
474485
if os.path.exists(os.path.join(result_path, "system_info.txt")):
475486
sys_info_file = os.path.join(result_path, "system_info.txt")
476487
elif model_platform_info_file:
477488
sys_info_file = model_platform_info_file
489+
478490
if sys_info_file:
479491
shutil.copy(sys_info_file, os.path.join(measurement_path, "system_info.txt"))
492+
else:
493+
if env.get('CM_GET_PLATFORM_DETAILS', '') == "yes":
494+
cm_input = {'action': 'run',
495+
'automation': 'script',
496+
'tags': 'get,platform,details',
497+
'env': {'CM_PLATFORM_DETAILS_FILE_PATH': os.path.join(measurement_path, "system_info.txt")},
498+
'quiet': True
499+
}
500+
r = cmind.access(cm_input)
501+
if r['return'] > 0:
502+
return r
480503

481504

482505
with open(system_file, "w") as fp:

0 commit comments

Comments
 (0)