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
92a3ae1b
Commit
92a3ae1b
authored
Aug 17, 2018
by
Paul
Browse files
Formatting
parent
bf794d08
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
src/onnx/perf_onnx.cpp
src/onnx/perf_onnx.cpp
+1
-1
src/program.cpp
src/program.cpp
+5
-4
No files found.
src/onnx/perf_onnx.cpp
View file @
92a3ae1b
...
...
@@ -24,7 +24,7 @@ int main(int argc, char const* argv[])
if
(
argc
>
1
)
{
std
::
string
file
=
argv
[
1
];
std
::
size_t
n
=
argc
>
2
?
std
::
stoul
(
argv
[
2
])
:
50
;
std
::
size_t
n
=
argc
>
2
?
std
::
stoul
(
argv
[
2
])
:
50
;
auto
p
=
migraph
::
parse_onnx
(
file
);
std
::
cout
<<
"Compiling ... "
<<
std
::
endl
;
p
.
compile
(
migraph
::
gpu
::
target
{});
...
...
src/program.cpp
View file @
92a3ae1b
...
...
@@ -323,8 +323,8 @@ argument program::eval(std::unordered_map<std::string, argument> params) const
double
common_average
(
const
std
::
vector
<
double
>&
v
)
{
std
::
size_t
n
=
v
.
size
()
/
4
;
double
total
=
std
::
accumulate
(
v
.
begin
()
+
n
,
v
.
end
()
-
n
,
0.0
);
return
total
/
std
::
distance
(
v
.
begin
()
+
n
,
v
.
end
()
-
n
);
double
total
=
std
::
accumulate
(
v
.
begin
()
+
n
,
v
.
end
()
-
n
,
0.0
);
return
total
/
std
::
distance
(
v
.
begin
()
+
n
,
v
.
end
()
-
n
);
}
void
program
::
perf_report
(
std
::
ostream
&
os
,
std
::
size_t
n
,
parameter_map
params
)
const
...
...
@@ -368,7 +368,7 @@ void program::perf_report(std::ostream& os, std::size_t n, parameter_map params)
}
double
total_time
=
common_average
(
total_vec
);
double
rate
=
std
::
ceil
(
1000.0
/
total_time
);
double
rate
=
std
::
ceil
(
1000.0
/
total_time
);
double
overhead_time
=
common_average
(
overhead_vec
);
double
overhead_percent
=
overhead_time
*
100.0
/
total_time
;
double
total_instruction_time
=
0.0
;
...
...
@@ -377,7 +377,8 @@ void program::perf_report(std::ostream& os, std::size_t n, parameter_map params)
double
calculate_overhead_time
=
total_time
-
total_instruction_time
;
double
calculate_overhead_percent
=
calculate_overhead_time
*
100.0
/
total_time
;
print_program
(
os
,
*
this
,
[
&
](
auto
ins
,
auto
&&
)
{
os
<<
": "
<<
common_average
(
ins_vec
[
ins
])
<<
"ms"
;
});
print_program
(
os
,
*
this
,
[
&
](
auto
ins
,
auto
&&
)
{
os
<<
": "
<<
common_average
(
ins_vec
[
ins
])
<<
"ms"
;
});
os
<<
"Rate: "
<<
rate
<<
"/sec"
<<
std
::
endl
;
os
<<
"Total time: "
<<
total_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