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
096c1130
Commit
096c1130
authored
Jun 08, 2018
by
Paul
Browse files
Hipmemcpy to copy from gpu
parent
f934f7a9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
test/miopen/miopen.cpp
test/miopen/miopen.cpp
+3
-3
No files found.
test/miopen/miopen.cpp
View file @
096c1130
...
...
@@ -45,11 +45,11 @@ hip_ptr write(const T& x)
}
template
<
class
T
>
std
::
vector
<
T
>
read
(
const
hip_ptr
&
x
,
std
::
size_t
sz
)
std
::
vector
<
T
>
read
(
const
void
*
x
,
std
::
size_t
sz
)
{
std
::
vector
<
T
>
result
(
sz
);
// TODO: Check status
hipMemcpy
(
result
.
data
(),
x
.
get
()
,
sz
*
sizeof
(
T
),
hipMemcpyDeviceToHost
);
hipMemcpy
(
result
.
data
(),
x
,
sz
*
sizeof
(
T
),
hipMemcpyDeviceToHost
);
return
result
;
}
...
...
@@ -108,7 +108,7 @@ std::vector<float> gpu()
auto
handle
=
make_obj
<
miopen_handle
>
(
&
miopenCreate
);
auto
r
=
p
.
eval
(
{{
"x"
,
x
},
{
"w"
,
w
},
{
"output"
,
y
},
{
"handle"
,
{
rtg
::
shape
::
any_type
,
handle
.
get
()}}});
r
.
visit
([
&
](
auto
output
)
{
result
.
assign
(
output
.
begin
(),
output
.
end
());
}
);
r
esult
=
read
<
float
>
(
r
.
data
(),
r
.
get_shape
().
elements
()
);
return
result
;
}
...
...
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