From 2f7489fbd565caff0608214808ef682b6f46f984 Mon Sep 17 00:00:00 2001 From: liaogang Date: Thu, 17 Aug 2017 10:14:48 +0800 Subject: [PATCH] change use_pinned_memory to true for cpu --- paddle/memory/detail/system_allocator.cc | 2 +- paddle/memory/memory.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/paddle/memory/detail/system_allocator.cc b/paddle/memory/detail/system_allocator.cc index f61e67a3290..a270bd59581 100644 --- a/paddle/memory/detail/system_allocator.cc +++ b/paddle/memory/detail/system_allocator.cc @@ -27,7 +27,7 @@ limitations under the License. */ // between host and device. Allocates too much would reduce the amount // of memory available to the system for paging. So, by default, we // should set false to use_pinned_memory. -DEFINE_bool(use_pinned_memory, false, "If set, allocate cpu pinned memory."); +DEFINE_bool(use_pinned_memory, true, "If set, allocate cpu pinned memory."); namespace paddle { namespace memory { diff --git a/paddle/memory/memory.cc b/paddle/memory/memory.cc index 5946c3ea4af..684635405a5 100644 --- a/paddle/memory/memory.cc +++ b/paddle/memory/memory.cc @@ -63,7 +63,7 @@ size_t Used(platform::CPUPlace place) { BuddyAllocator* GetGPUBuddyAllocator(int gpu_id) { using BuddyAllocVec = std::vector; static std::unique_ptr as{ - new std::vector, [](BuddyAllocVec* p) { + new BuddyAllocVec, [](BuddyAllocVec* p) { std::for_each(p->begin(), p->end(), [](BuddyAllocator* p) { delete p; }); }}; -- GitLab