From ac80273686629fe3fb576d7cf8dd981f0a146a1b Mon Sep 17 00:00:00 2001 From: minqiyang Date: Wed, 23 Jan 2019 19:13:15 +0800 Subject: [PATCH] Change definitions to PADDLE_WITH_JEMALLOC --- CMakeLists.txt | 2 +- paddle/fluid/memory/allocation/legacy_allocator.cc | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6aa8f1b85..b3111eed8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -265,7 +265,7 @@ endif() if (WITH_JEMALLOC) find_package(JeMalloc REQUIRED) include_directories(${JEMALLOC_INCLUDE_DIR}) - add_definitions(-DWITH_JEMALLOC) + add_definitions(-DPADDLE_WITH_JEMALLOC) endif() include(generic) # simplify cmake module diff --git a/paddle/fluid/memory/allocation/legacy_allocator.cc b/paddle/fluid/memory/allocation/legacy_allocator.cc index cf6d351a41..04a68d6c23 100644 --- a/paddle/fluid/memory/allocation/legacy_allocator.cc +++ b/paddle/fluid/memory/allocation/legacy_allocator.cc @@ -17,7 +17,7 @@ #include #include -#ifdef WITH_JEMALLOC +#ifdef PADDLE_WITH_JEMALLOC #include #endif @@ -95,7 +95,7 @@ struct NaiveAllocator { template <> void *Alloc(const platform::CPUPlace &place, size_t size) { VLOG(10) << "Allocate " << size << " bytes on " << platform::Place(place); -#ifdef WITH_JEMALLOC +#ifdef PADDLE_WITH_JEMALLOC void *p = malloc(size); #else void *p = GetCPUBuddyAllocator()->Alloc(size); @@ -110,7 +110,7 @@ void *Alloc(const platform::CPUPlace &place, size_t size) { template <> void Free(const platform::CPUPlace &place, void *p) { VLOG(10) << "Free pointer=" << p << " on " << platform::Place(place); -#ifdef WITH_JEMALLOC +#ifdef PADDLE_WITH_JEMALLOC free(p); #else GetCPUBuddyAllocator()->Free(p); @@ -119,8 +119,8 @@ void Free(const platform::CPUPlace &place, void *p) { template <> size_t Used(const platform::CPUPlace &place) { -#ifdef WITH_JEMALLOC - // fake the result of used memory when WITH_JEMALLOC is ON +#ifdef PADDLE_WITH_JEMALLOC + // fake the result of used memory when PADDLE_WITH_JEMALLOC is ON return 0U; #else return GetCPUBuddyAllocator()->Used(); -- GitLab