提交 2f7489fb 编写于 作者: L liaogang

change use_pinned_memory to true for cpu

上级 ac02fb82
...@@ -27,7 +27,7 @@ limitations under the License. */ ...@@ -27,7 +27,7 @@ limitations under the License. */
// between host and device. Allocates too much would reduce the amount // between host and device. Allocates too much would reduce the amount
// of memory available to the system for paging. So, by default, we // of memory available to the system for paging. So, by default, we
// should set false to use_pinned_memory. // 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 paddle {
namespace memory { namespace memory {
......
...@@ -63,7 +63,7 @@ size_t Used<platform::CPUPlace>(platform::CPUPlace place) { ...@@ -63,7 +63,7 @@ size_t Used<platform::CPUPlace>(platform::CPUPlace place) {
BuddyAllocator* GetGPUBuddyAllocator(int gpu_id) { BuddyAllocator* GetGPUBuddyAllocator(int gpu_id) {
using BuddyAllocVec = std::vector<BuddyAllocator*>; using BuddyAllocVec = std::vector<BuddyAllocator*>;
static std::unique_ptr<BuddyAllocVec, void (*)(BuddyAllocVec * p)> as{ static std::unique_ptr<BuddyAllocVec, void (*)(BuddyAllocVec * p)> as{
new std::vector<BuddyAllocator*>, [](BuddyAllocVec* p) { new BuddyAllocVec, [](BuddyAllocVec* p) {
std::for_each(p->begin(), p->end(), std::for_each(p->begin(), p->end(),
[](BuddyAllocator* p) { delete p; }); [](BuddyAllocator* p) { delete p; });
}}; }};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册