提交 028f3dc4 编写于 作者: L liaogang

Add memcpy

上级 48cf64e8
...@@ -47,6 +47,20 @@ size_t Used<platform::CPUPlace>(platform::CPUPlace place) { ...@@ -47,6 +47,20 @@ size_t Used<platform::CPUPlace>(platform::CPUPlace place) {
return GetCPUBuddyAllocator()->Used(); return GetCPUBuddyAllocator()->Used();
} }
template <>
void Copy<platform::CPUPlace, platform::CPUPlace>(platform::CPUPlace, void* dst,
platform::CPUPlace, void* src,
size_t size) {
memcpy(dst, src, size);
}
template <>
void Copy<platform::CPUPlace, platform::GPUPlace>(platform::CPUPlace, void* dst,
platform::CPUPlace, void* src,
size_t size) {
memcpy(dst, src, size);
}
#ifndef PADDLE_ONLY_CPU #ifndef PADDLE_ONLY_CPU
detail::BuddyAllocator* GetGPUBuddyAllocator(int gpu_id) { detail::BuddyAllocator* GetGPUBuddyAllocator(int gpu_id) {
......
...@@ -28,5 +28,8 @@ void Free(Place, void*); ...@@ -28,5 +28,8 @@ void Free(Place, void*);
template <class Place> template <class Place>
size_t Used(Place); size_t Used(Place);
template <class Place1, class Place2>
void Copy(Place1, void* dst, Place2, void* src, size_t size);
} // namespace memory } // namespace memory
} // namespace paddle } // namespace paddle
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册