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
a5971c5a
"research/syntaxnet/docker-devel/Dockerfile-test-base" did not exist on "87a8abd4d30f6d4a8df5f7b2ad251ea732ffe6b8"
Commit
a5971c5a
authored
Aug 29, 2018
by
Paul
Browse files
Unify verification between the tests and onnx
parent
c5402b18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
56 deletions
+3
-56
src/onnx/verify_onnx.cpp
src/onnx/verify_onnx.cpp
+2
-16
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+1
-40
No files found.
src/onnx/verify_onnx.cpp
View file @
a5971c5a
...
...
@@ -5,7 +5,7 @@
#include <migraph/gpu/target.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/generate.hpp>
#include <migraph/verify.hpp>
#include <migraph/verify
_args
.hpp>
migraph
::
argument
run_cpu
(
const
std
::
string
&
file
)
{
...
...
@@ -46,20 +46,6 @@ int main(int argc, char const* argv[])
auto
x
=
run_cpu
(
file
);
auto
y
=
run_gpu
(
file
);
visit_all
(
x
,
y
)([](
auto
cpu
,
auto
gpu
)
{
if
(
migraph
::
verify_range
(
cpu
,
gpu
,
100
))
{
std
::
cout
<<
"Passed"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"Not equal"
<<
std
::
endl
;
std
::
cout
<<
"cpu:"
<<
std
::
endl
;
std
::
cout
<<
cpu
<<
std
::
endl
;
std
::
cout
<<
"gpu:"
<<
std
::
endl
;
std
::
cout
<<
gpu
<<
std
::
endl
;
}
});
migraph
::
verify_args
(
file
,
x
,
y
,
100
);
}
}
test/gpu/miopen.cpp
View file @
a5971c5a
...
...
@@ -8,7 +8,7 @@
#include <migraph/gpu/hip.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/type_name.hpp>
#include <migraph/verify.hpp>
#include <migraph/verify
_args
.hpp>
#include <miopen/miopen.h>
...
...
@@ -127,45 +127,6 @@ migraph::argument run_gpu()
return
migraph
::
gpu
::
from_gpu
(
p
.
eval
(
m
));
}
void
verify_args
(
const
std
::
string
&
name
,
const
migraph
::
argument
&
cpu_arg
,
const
migraph
::
argument
&
gpu_arg
)
{
visit_all
(
cpu_arg
,
gpu_arg
)([
&
](
auto
cpu
,
auto
gpu
)
{
if
(
not
migraph
::
verify_range
(
cpu
,
gpu
))
{
// TODO: Check for nans
std
::
cout
<<
"FAILED: "
<<
name
<<
std
::
endl
;
if
(
cpu
.
size
()
<
32
)
std
::
cout
<<
"cpu:"
<<
cpu
<<
std
::
endl
;
if
(
gpu
.
size
()
<
32
)
std
::
cout
<<
"gpu:"
<<
gpu
<<
std
::
endl
;
if
(
migraph
::
range_zero
(
cpu
))
std
::
cout
<<
"Cpu data is all zeros"
<<
std
::
endl
;
if
(
migraph
::
range_zero
(
gpu
))
std
::
cout
<<
"Gpu data is all zeros"
<<
std
::
endl
;
auto
idx
=
migraph
::
mismatch_idx
(
cpu
,
gpu
,
migraph
::
float_equal
);
if
(
idx
<
migraph
::
range_distance
(
cpu
))
{
std
::
cout
<<
"Mismatch at "
<<
idx
<<
": "
<<
cpu
[
idx
]
<<
" != "
<<
gpu
[
idx
]
<<
std
::
endl
;
}
auto
cpu_nan_idx
=
find_idx
(
cpu
,
migraph
::
not_finite
);
if
(
cpu_nan_idx
>=
0
)
std
::
cout
<<
"Non finite number found in cpu at "
<<
cpu_nan_idx
<<
": "
<<
cpu
[
cpu_nan_idx
]
<<
std
::
endl
;
auto
gpu_nan_idx
=
find_idx
(
gpu
,
migraph
::
not_finite
);
if
(
gpu_nan_idx
>=
0
)
std
::
cout
<<
"Non finite number found in gpu at "
<<
gpu_nan_idx
<<
": "
<<
gpu
[
gpu_nan_idx
]
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
}
});
}
template
<
class
V
>
void
verify_program
()
{
...
...
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