Skip to content
Merged
Changes from all commits
Commits
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: 13 additions & 4 deletions mlperf_logging/result_summarizer/result_summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

def _get_sub_folders(folder):
sub_folders = [
os.path.join(folder, sub_folder) for sub_folder in os.listdir(folder)
os.path.join(folder, sub_folder) for sub_folder in sorted(os.listdir(folder))
]
return [
sub_folder for sub_folder in sub_folders if os.path.isdir(sub_folder)
Expand Down Expand Up @@ -816,11 +816,16 @@ def _fill_empty_benchmark_scores(
benchmark_scores[benchmark] = None


def _get_id_from_sysinfo(summary):
# Strings already hashed into private ids, shared across all summarized folders.
_hashed_strings = set()


def _get_id_from_sysinfo(summary, system):
"""Generate private id from system information.

Args:
summary (dictionary): Sysinfo Dictionary
system (str): System name, appended to the hash source if it is a duplicate
"""


Expand Down Expand Up @@ -927,6 +932,10 @@ def get_hash(row):
'framework'
]
to_hash = ''.join(str(row[c]) for c in columns_for_hashing)
# Disambiguate systems whose hash source collides with a previous one
if to_hash in _hashed_strings:
to_hash += system
_hashed_strings.add(to_hash)
return hashlib.sha256(to_hash.encode('utf-8')).hexdigest()

hash = get_hash(summary)
Expand Down Expand Up @@ -962,7 +971,7 @@ def summarize_results(folder, usage, ruleset, csv_file=None, **kwargs):
id = _get_id_file(folder, system)
# Generate private id and update system desc to match
if kwargs.get('generate_private_ids') and 'private_id' not in id:
id['private_id'] = _get_id_from_sysinfo(desc)
id['private_id'] = _get_id_from_sysinfo(desc, system)
_update_id_file(folder, system, id['private_id'])
elif 'private_id' not in id:
# Ensure private_id field exists in desc for consistent processing later, even if it's empty
Expand Down Expand Up @@ -1189,7 +1198,7 @@ def _update_summaries(folder):
if ',' in path_suffix:
orgs = multiple_folders.group(2).split(',')
elif '*' == path_suffix:
orgs = os.listdir(path_prefix)
orgs = sorted(os.listdir(path_prefix))
orgs = [
org for org in orgs
if _is_organization_folder(os.path.join(path_prefix, org))
Expand Down
Loading