Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cb-util
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christoph Alt
cb-util
Commits
a2ed392c
Commit
a2ed392c
authored
1 year ago
by
Christoph Alt
Browse files
Options
Downloads
Patches
Plain Diff
addded a script for parsing the benchmarking results
parent
31a8eb74
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
roofline_data/parse_summaries.py
+76
-0
76 additions, 0 deletions
roofline_data/parse_summaries.py
with
76 additions
and
0 deletions
roofline_data/parse_summaries.py
0 → 100644
+
76
−
0
View file @
a2ed392c
import
json
import
argparse
def
parse_benchmarks
(
lines
):
perf
=
{}
bw
=
{}
current_dict
=
None
for
line
in
lines
:
if
line
.
startswith
(
"
Performance Benchmarks:
"
):
current_dict
=
perf
elif
line
.
startswith
(
"
Bandwidth Benchmarks:
"
):
current_dict
=
bw
else
:
parts
=
line
.
split
()
if
len
(
parts
)
==
3
:
key
=
parts
[
0
]
value
=
float
(
parts
[
1
])
current_dict
[
key
]
=
value
return
perf
,
bw
def
transform_to_json
(
file_content
):
lines
=
file_content
.
split
(
'
\n
'
)
hostname
=
lines
[
0
].
split
()[
0
]
date
=
'
'
.
join
(
lines
[
0
].
split
()[
1
:
6
])
perf
,
bw
=
parse_benchmarks
(
lines
[
1
:])
result
=
{
"
hostname
"
:
hostname
,
"
date
"
:
date
,
"
perf
"
:
perf
,
"
bw
"
:
bw
}
return
result
def
get_data
(
output_file
):
try
:
with
open
(
output_file
,
"
r
"
)
as
file
:
data
=
json
.
load
(
file
)
return
data
except
(
FileNotFoundError
,
):
return
{}
def
parse_input_files
(
input_files
):
data
=
dict
()
for
input_file
in
input_files
:
with
open
(
input_file
,
'
r
'
)
as
f
:
file_content
=
f
.
read
()
json_output
=
transform_to_json
(
file_content
)
data
.
update
({
json_output
[
"
hostname
"
]:
json_output
})
return
data
def
main
(
input_files
,
output_file
):
data
=
get_data
(
output_file
)
data
.
update
(
parse_input_files
(
input_files
))
with
open
(
output_file
,
"
w
"
)
as
f
:
json
.
dump
(
data
,
f
,
indent
=
4
)
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
(
description
=
"
Transform benchmark files to JSON format.
"
)
parser
.
add_argument
(
"
input_files
"
,
nargs
=
"
+
"
,
help
=
"
Input benchmark files
"
)
parser
.
add_argument
(
"
-o
"
,
"
--output_file
"
,
help
=
"
Output JSON file
"
,
required
=
True
)
args
=
parser
.
parse_args
()
main
(
args
.
input_files
,
args
.
output_file
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment