diff --git a/paddle/memory/memory.cc b/paddle/memory/memory.cc index 430ce98bfc1454856a2a4ec76078931b90e588b8..5be9bef3ac37f19edc92d4845fd1982ad38979d7 100644 --- a/paddle/memory/memory.cc +++ b/paddle/memory/memory.cc @@ -47,6 +47,20 @@ size_t Used(platform::CPUPlace place) { return GetCPUBuddyAllocator()->Used(); } +template <> +void Copy(platform::CPUPlace, void* dst, + platform::CPUPlace, void* src, + size_t size) { + memcpy(dst, src, size); +} + +template <> +void Copy(platform::CPUPlace, void* dst, + platform::CPUPlace, void* src, + size_t size) { + memcpy(dst, src, size); +} + #ifndef PADDLE_ONLY_CPU detail::BuddyAllocator* GetGPUBuddyAllocator(int gpu_id) { diff --git a/paddle/memory/memory.h b/paddle/memory/memory.h index 2d6f4fd2a08ee0039647d276476263d0f8d00329..96c00cb106b70ce425b349e5baca23a4ca746f37 100644 --- a/paddle/memory/memory.h +++ b/paddle/memory/memory.h @@ -28,5 +28,8 @@ void Free(Place, void*); template size_t Used(Place); +template +void Copy(Place1, void* dst, Place2, void* src, size_t size); + } // namespace memory } // namespace paddle