未验证 提交 c770d5c0 编写于 作者: Y Yancey 提交者: GitHub

fix build error with testing and gpu on (#10932)

上级 cd8700f1
...@@ -149,12 +149,14 @@ void SerializeToByteBuffer(const std::string& name, framework::Variable* var, ...@@ -149,12 +149,14 @@ void SerializeToByteBuffer(const std::string& name, framework::Variable* var,
} }
if (platform::is_gpu_place(ctx.GetPlace())) { if (platform::is_gpu_place(ctx.GetPlace())) {
#ifdef PADDLE_WITH_CUDA
// GPU data is copied to CPU buffer when sending, // GPU data is copied to CPU buffer when sending,
// free the buffer when possible. // free the buffer when possible.
destroy_callback = [](void* backing) { destroy_callback = [](void* backing) {
platform::CUDAPinnedPlace cuda_pinned; platform::CUDAPinnedPlace cuda_pinned;
memory::Free(cuda_pinned, backing); memory::Free(cuda_pinned, backing);
}; };
#endif
} }
std::string header; std::string header;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册