Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
da7d6cf2
Commit
da7d6cf2
authored
Jun 08, 2022
by
turneram
Browse files
Add average, std deviation, and median to perf report
parent
7271ddbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
src/program.cpp
src/program.cpp
+24
-0
No files found.
src/program.cpp
View file @
da7d6cf2
...
@@ -577,6 +577,24 @@ double common_average(const std::vector<double>& v)
...
@@ -577,6 +577,24 @@ double common_average(const std::vector<double>& v)
return
total
/
std
::
distance
(
v
.
begin
()
+
n
,
v
.
end
()
-
n
);
return
total
/
std
::
distance
(
v
.
begin
()
+
n
,
v
.
end
()
-
n
);
}
}
double
total_average
(
const
std
::
vector
<
double
>&
v
)
{
double
total
=
std
::
accumulate
(
v
.
begin
(),
v
.
end
(),
0.0
);
return
total
/
v
.
size
();
}
double
std_deviation
(
const
std
::
vector
<
double
>&
v
)
{
auto
mean
=
total_average
(
v
);
auto
var
=
std
::
accumulate
(
v
.
begin
(),
v
.
end
(),
0.0
,
[
&
](
auto
a
,
auto
b
){
return
a
+
std
::
pow
(
b
-
mean
,
2
);
});
return
std
::
sqrt
(
var
/
v
.
size
());
}
double
median
(
const
std
::
vector
<
double
>&
v
)
{
return
v
[(
v
.
size
()
/
2
)
-
1
];
}
std
::
string
perf_group
(
const
operation
&
op
)
std
::
string
perf_group
(
const
operation
&
op
)
{
{
auto
attr
=
op
.
attributes
();
auto
attr
=
op
.
attributes
();
...
@@ -652,6 +670,9 @@ void program::perf_report(std::ostream& os,
...
@@ -652,6 +670,9 @@ void program::perf_report(std::ostream& os,
overhead_vec
.
push_back
(
time
<
milliseconds
>
([
&
]
{
dry_run
(
params
);
}));
overhead_vec
.
push_back
(
time
<
milliseconds
>
([
&
]
{
dry_run
(
params
);
}));
}
}
double
average
=
total_average
(
total_vec
);
double
med
=
median
(
total_vec
);
double
std_dev
=
std_deviation
(
total_vec
);
double
total_time
=
common_average
(
total_vec
);
double
total_time
=
common_average
(
total_vec
);
double
rate
=
1000.0
/
total_time
;
double
rate
=
1000.0
/
total_time
;
double
overhead_time
=
common_average
(
overhead_vec
);
double
overhead_time
=
common_average
(
overhead_vec
);
...
@@ -700,6 +721,9 @@ void program::perf_report(std::ostream& os,
...
@@ -700,6 +721,9 @@ void program::perf_report(std::ostream& os,
os
<<
std
::
endl
;
os
<<
std
::
endl
;
os
<<
"Batch size: "
<<
batch
<<
std
::
endl
;
os
<<
"Batch size: "
<<
batch
<<
std
::
endl
;
os
<<
"Average: "
<<
average
<<
std
::
endl
;
os
<<
"Median: "
<<
med
<<
std
::
endl
;
os
<<
"Standard deviation: "
<<
std_dev
<<
std
::
endl
;
os
<<
"Rate: "
<<
rate
*
batch
<<
"/sec"
<<
std
::
endl
;
os
<<
"Rate: "
<<
rate
*
batch
<<
"/sec"
<<
std
::
endl
;
os
<<
"Total time: "
<<
total_time
<<
"ms"
<<
std
::
endl
;
os
<<
"Total time: "
<<
total_time
<<
"ms"
<<
std
::
endl
;
os
<<
"Total instructions time: "
<<
total_instruction_time
<<
"ms"
<<
std
::
endl
;
os
<<
"Total instructions time: "
<<
total_instruction_time
<<
"ms"
<<
std
::
endl
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment