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
dae49b65
Commit
dae49b65
authored
Aug 14, 2018
by
Paul
Browse files
Merge branch 'concurrent-verify'
parents
e0389cca
5e69bc62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+17
-3
No files found.
test/gpu/miopen.cpp
View file @
dae49b65
...
...
@@ -11,6 +11,9 @@
#include <miopen/miopen.h>
#include <future>
#include <thread>
#include "test.hpp"
#include "verify.hpp"
...
...
@@ -19,6 +22,17 @@
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
// An improved async, that doesn't block
template
<
class
Function
>
std
::
future
<
typename
std
::
result_of
<
Function
()
>::
type
>
detach_async
(
Function
&&
f
)
{
using
result_type
=
typename
std
::
result_of
<
Function
()
>::
type
;
std
::
packaged_task
<
result_type
()
>
task
(
std
::
forward
<
Function
>
(
f
));
auto
fut
=
task
.
get_future
();
std
::
thread
(
std
::
move
(
task
)).
detach
();
return
std
::
move
(
fut
);
}
struct
auto_print
{
static
std
::
array
<
std
::
function
<
void
()
>
,
2
>
handlers
;
...
...
@@ -85,9 +99,9 @@ void verify_program()
for
(
auto
&&
handle
:
auto_print
::
handlers
)
handle
();
});
auto
cpu_arg
=
run_cpu
<
V
>
();
auto
gpu_arg
=
run_gpu
<
V
>
();
visit_all
(
cpu_arg
,
gpu_arg
)([](
auto
cpu
,
auto
gpu
)
{
auto
cpu_arg
_f
=
detach_async
([]
{
return
run_cpu
<
V
>
();
});
auto
gpu_arg
=
run_gpu
<
V
>
();
visit_all
(
cpu_arg
_f
.
get
()
,
gpu_arg
)([](
auto
cpu
,
auto
gpu
)
{
if
(
not
test
::
verify_range
(
cpu
,
gpu
))
{
std
::
cout
<<
"FAILED: "
<<
migraph
::
get_type_name
<
V
>
()
<<
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