提交 ac802736 编写于 作者: M minqiyang

Change definitions to PADDLE_WITH_JEMALLOC

上级 29ceb931
...@@ -265,7 +265,7 @@ endif() ...@@ -265,7 +265,7 @@ endif()
if (WITH_JEMALLOC) if (WITH_JEMALLOC)
find_package(JeMalloc REQUIRED) find_package(JeMalloc REQUIRED)
include_directories(${JEMALLOC_INCLUDE_DIR}) include_directories(${JEMALLOC_INCLUDE_DIR})
add_definitions(-DWITH_JEMALLOC) add_definitions(-DPADDLE_WITH_JEMALLOC)
endif() endif()
include(generic) # simplify cmake module include(generic) # simplify cmake module
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#ifdef WITH_JEMALLOC #ifdef PADDLE_WITH_JEMALLOC
#include <jemalloc/jemalloc.h> #include <jemalloc/jemalloc.h>
#endif #endif
...@@ -95,7 +95,7 @@ struct NaiveAllocator { ...@@ -95,7 +95,7 @@ struct NaiveAllocator {
template <> template <>
void *Alloc<platform::CPUPlace>(const platform::CPUPlace &place, size_t size) { void *Alloc<platform::CPUPlace>(const platform::CPUPlace &place, size_t size) {
VLOG(10) << "Allocate " << size << " bytes on " << platform::Place(place); VLOG(10) << "Allocate " << size << " bytes on " << platform::Place(place);
#ifdef WITH_JEMALLOC #ifdef PADDLE_WITH_JEMALLOC
void *p = malloc(size); void *p = malloc(size);
#else #else
void *p = GetCPUBuddyAllocator()->Alloc(size); void *p = GetCPUBuddyAllocator()->Alloc(size);
...@@ -110,7 +110,7 @@ void *Alloc<platform::CPUPlace>(const platform::CPUPlace &place, size_t size) { ...@@ -110,7 +110,7 @@ void *Alloc<platform::CPUPlace>(const platform::CPUPlace &place, size_t size) {
template <> template <>
void Free<platform::CPUPlace>(const platform::CPUPlace &place, void *p) { void Free<platform::CPUPlace>(const platform::CPUPlace &place, void *p) {
VLOG(10) << "Free pointer=" << p << " on " << platform::Place(place); VLOG(10) << "Free pointer=" << p << " on " << platform::Place(place);
#ifdef WITH_JEMALLOC #ifdef PADDLE_WITH_JEMALLOC
free(p); free(p);
#else #else
GetCPUBuddyAllocator()->Free(p); GetCPUBuddyAllocator()->Free(p);
...@@ -119,8 +119,8 @@ void Free<platform::CPUPlace>(const platform::CPUPlace &place, void *p) { ...@@ -119,8 +119,8 @@ void Free<platform::CPUPlace>(const platform::CPUPlace &place, void *p) {
template <> template <>
size_t Used<platform::CPUPlace>(const platform::CPUPlace &place) { size_t Used<platform::CPUPlace>(const platform::CPUPlace &place) {
#ifdef WITH_JEMALLOC #ifdef PADDLE_WITH_JEMALLOC
// fake the result of used memory when WITH_JEMALLOC is ON // fake the result of used memory when PADDLE_WITH_JEMALLOC is ON
return 0U; return 0U;
#else #else
return GetCPUBuddyAllocator()->Used(); return GetCPUBuddyAllocator()->Used();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册