Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
385411e6
Commit
385411e6
authored
Sep 18, 2018
by
Paul
Browse files
Print program on failure
parent
b247729a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
src/include/migraph/verify_args.hpp
src/include/migraph/verify_args.hpp
+6
-3
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+18
-7
No files found.
src/include/migraph/verify_args.hpp
View file @
385411e6
...
...
@@ -6,14 +6,16 @@
namespace
migraph
{
inline
void
verify_args
(
const
std
::
string
&
name
,
inline
bool
verify_args
(
const
std
::
string
&
name
,
const
argument
&
cpu_arg
,
const
argument
&
gpu_arg
,
double
tolerance
=
80
)
{
bool
passed
=
true
;
visit_all
(
cpu_arg
,
gpu_arg
)([
&
](
auto
cpu
,
auto
gpu
)
{
double
error
;
if
(
not
verify_range
(
cpu
,
gpu
,
tolerance
,
&
error
))
passed
=
verify_range
(
cpu
,
gpu
,
tolerance
,
&
error
);
if
(
not
passed
)
{
// TODO: Check for nans
std
::
cout
<<
"FAILED: "
<<
name
<<
std
::
endl
;
...
...
@@ -74,9 +76,10 @@ inline void verify_args(const std::string& name,
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
;
//
std::cout << std::endl;
}
});
return
passed
;
}
}
// namespace migraph
...
...
test/gpu/miopen.cpp
View file @
385411e6
...
...
@@ -97,10 +97,10 @@ void compile_check(migraph::program& p, const migraph::target& t)
}
template
<
class
V
>
migraph
::
argument
run_cpu
()
migraph
::
argument
run_cpu
(
migraph
::
program
&
p
)
{
V
v
;
auto
p
=
v
.
create_program
();
p
=
v
.
create_program
();
auto_print
pp
{
p
,
0
};
compile_check
(
p
,
migraph
::
cpu
::
cpu_target
{});
migraph
::
program
::
parameter_map
m
;
...
...
@@ -112,10 +112,10 @@ migraph::argument run_cpu()
}
template
<
class
V
>
migraph
::
argument
run_gpu
()
migraph
::
argument
run_gpu
(
migraph
::
program
&
p
)
{
V
v
;
auto
p
=
v
.
create_program
();
p
=
v
.
create_program
();
auto_print
pp
{
p
,
1
};
compile_check
(
p
,
migraph
::
gpu
::
target
{});
migraph
::
program
::
parameter_map
m
;
...
...
@@ -131,9 +131,20 @@ template <class V>
void
verify_program
()
{
auto_print
::
set_terminate_handler
(
migraph
::
get_type_name
<
V
>
());
auto
cpu_arg_f
=
detach_async
([]
{
return
run_cpu
<
V
>
();
});
auto
gpu_arg
=
run_gpu
<
V
>
();
verify_args
(
migraph
::
get_type_name
<
V
>
(),
cpu_arg_f
.
get
(),
gpu_arg
);
migraph
::
program
cpu_prog
;
migraph
::
program
gpu_prog
;
auto
cpu_arg_f
=
detach_async
([
&
]
{
return
run_cpu
<
V
>
(
cpu_prog
);
});
auto
gpu_arg
=
run_gpu
<
V
>
(
gpu_prog
);
bool
passed
=
verify_args
(
migraph
::
get_type_name
<
V
>
(),
cpu_arg_f
.
get
(),
gpu_arg
);
if
(
not
passed
)
{
V
v
;
auto
p
=
v
.
create_program
();
std
::
cout
<<
p
<<
std
::
endl
;
std
::
cout
<<
"cpu:
\n
"
<<
cpu_prog
<<
std
::
endl
;
std
::
cout
<<
"gpu:
\n
"
<<
gpu_prog
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
}
std
::
set_terminate
(
nullptr
);
}
...
...
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