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
f923d0ee
"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "832f28c65097927d220b407b5d62de60ea9b3cf0"
Commit
f923d0ee
authored
Aug 14, 2018
by
Paul
Browse files
Run cpu and gpu at the same time
parent
f0604d78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+16
-2
No files found.
test/gpu/miopen.cpp
View file @
f923d0ee
...
...
@@ -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
cpu_arg
_f
=
detach_async
([]
{
return
run_cpu
<
V
>
();
});
auto
gpu_arg
=
run_gpu
<
V
>
();
visit_all
(
cpu_arg
,
gpu_arg
)([](
auto
cpu
,
auto
gpu
)
{
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