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
8dbabda5
Commit
8dbabda5
authored
Aug 29, 2018
by
Paul
Browse files
Print out error amount
parent
a5d58187
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
src/include/migraph/generate.hpp
src/include/migraph/generate.hpp
+1
-1
src/include/migraph/verify.hpp
src/include/migraph/verify.hpp
+3
-1
src/include/migraph/verify_args.hpp
src/include/migraph/verify_args.hpp
+3
-1
No files found.
src/include/migraph/generate.hpp
View file @
8dbabda5
...
@@ -12,7 +12,7 @@ constexpr T normalize(unsigned long z)
...
@@ -12,7 +12,7 @@ constexpr T normalize(unsigned long z)
{
{
if
(
z
==
0
)
if
(
z
==
0
)
return
0
;
return
0
;
const
auto
max
=
3276
8
;
const
auto
max
=
204
8
;
const
double
range
=
max
/
2
;
// NOLINT
const
double
range
=
max
/
2
;
// NOLINT
double
result
=
(
z
%
max
)
/
range
;
double
result
=
(
z
%
max
)
/
range
;
result
-=
1
;
result
-=
1
;
...
...
src/include/migraph/verify.hpp
View file @
8dbabda5
...
@@ -162,10 +162,12 @@ double rms_range(R1&& r1, R2&& r2)
...
@@ -162,10 +162,12 @@ double rms_range(R1&& r1, R2&& r2)
}
}
template
<
class
R1
,
class
R2
>
template
<
class
R1
,
class
R2
>
bool
verify_range
(
R1
&&
r1
,
R2
&&
r2
,
double
tolerance
=
80
)
bool
verify_range
(
R1
&&
r1
,
R2
&&
r2
,
double
tolerance
=
80
,
double
*
out_error
=
nullptr
)
{
{
double
threshold
=
std
::
numeric_limits
<
range_value
<
R1
>>::
epsilon
()
*
tolerance
;
double
threshold
=
std
::
numeric_limits
<
range_value
<
R1
>>::
epsilon
()
*
tolerance
;
auto
error
=
rms_range
(
r1
,
r2
);
auto
error
=
rms_range
(
r1
,
r2
);
if
(
out_error
!=
nullptr
)
*
out_error
=
error
;
return
error
<=
threshold
;
return
error
<=
threshold
;
}
}
}
// namespace migraph
}
// namespace migraph
...
...
src/include/migraph/verify_args.hpp
View file @
8dbabda5
...
@@ -12,10 +12,12 @@ inline void verify_args(const std::string& name,
...
@@ -12,10 +12,12 @@ inline void verify_args(const std::string& name,
double
tolerance
=
80
)
double
tolerance
=
80
)
{
{
visit_all
(
cpu_arg
,
gpu_arg
)([
&
](
auto
cpu
,
auto
gpu
)
{
visit_all
(
cpu_arg
,
gpu_arg
)([
&
](
auto
cpu
,
auto
gpu
)
{
if
(
not
verify_range
(
cpu
,
gpu
,
tolerance
))
double
error
;
if
(
not
verify_range
(
cpu
,
gpu
,
tolerance
,
&
error
))
{
{
// TODO: Check for nans
// TODO: Check for nans
std
::
cout
<<
"FAILED: "
<<
name
<<
std
::
endl
;
std
::
cout
<<
"FAILED: "
<<
name
<<
std
::
endl
;
std
::
cout
<<
"error: "
<<
error
<<
std
::
endl
;
if
(
cpu
.
size
()
<
32
)
if
(
cpu
.
size
()
<
32
)
std
::
cout
<<
"cpu:"
<<
cpu
<<
std
::
endl
;
std
::
cout
<<
"cpu:"
<<
cpu
<<
std
::
endl
;
if
(
gpu
.
size
()
<
32
)
if
(
gpu
.
size
()
<
32
)
...
...
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