"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "0b7672d7dc246f708f46102ddbaa2d7afb2b54f9"
Commit 966d45df authored by Paul's avatar Paul
Browse files

Add copy syncs

parent 3018c722
......@@ -49,10 +49,12 @@ hip_ptr write_to_gpu(const T& x)
template <class T>
std::vector<T> read_from_gpu(const void* x, std::size_t sz)
{
gpu_sync();
std::vector<T> result(sz);
auto status = hipMemcpy(result.data(), x, sz * sizeof(T), hipMemcpyDeviceToHost);
if(status != hipSuccess)
MIGRAPH_THROW("Copy from gpu failed: " + hip_error(status)); // NOLINT
gpu_sync();
return result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment