From 3c9755bbb948e4a58c6b67dad1fd40a52be696e6 Mon Sep 17 00:00:00 2001 From: Tao Luo Date: Wed, 26 Jun 2019 16:37:47 +0800 Subject: [PATCH] remove unused jemalloc option (#18314) test=develop --- CMakeLists.txt | 7 ----- cmake/FindJeMalloc.cmake | 28 ------------------- cmake/generic.cmake | 4 --- .../memory/allocation/legacy_allocator.cc | 17 ----------- paddle/scripts/paddle_build.sh | 2 -- 5 files changed, 58 deletions(-) delete mode 100644 cmake/FindJeMalloc.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index bd113a9ec8a..be0d5bf8455 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,6 @@ option(WITH_ANAKIN "Compile with Anakin library" OFF) option(WITH_AMD_GPU "Compile PaddlePaddle with AMD GPU" OFF) option(WITH_NGRAPH "Compile PaddlePaddle with nGraph support." OFF) option(WITH_PROFILER "Compile PaddlePaddle with GPU profiler and gperftools" OFF) -option(WITH_JEMALLOC "Compile PaddlePaddle with jemalloc" OFF) option(WITH_COVERAGE "Compile PaddlePaddle with code coverage" OFF) option(COVERALLS_UPLOAD "Package code coverage data to coveralls" OFF) option(WITH_PSLIB "Compile with pslib support" OFF) @@ -219,12 +218,6 @@ if (WITH_PROFILER) add_definitions(-DWITH_GPERFTOOLS) endif() -if (WITH_JEMALLOC) - find_package(JeMalloc REQUIRED) - include_directories(${JEMALLOC_INCLUDE_DIR}) - add_definitions(-DPADDLE_WITH_JEMALLOC) -endif() - include(generic) # simplify cmake module include(package) # set paddle packages include(ccache) # set ccache for compilation diff --git a/cmake/FindJeMalloc.cmake b/cmake/FindJeMalloc.cmake deleted file mode 100644 index b95287160ba..00000000000 --- a/cmake/FindJeMalloc.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# - Find JeMalloc library -# Find the native JeMalloc includes and library -# -# JEMALLOC_INCLUDE_DIR - where to find jemalloc.h, etc. -# JEMALLOC_LIBRARIES - List of libraries when using jemalloc. -# JEMALLOC_FOUND - True if jemalloc found. - -find_path(JEMALLOC_INCLUDE_DIR - NAMES jemalloc/jemalloc.h - HINTS ${JEMALLOC_ROOT_DIR}/include) - -find_library(JEMALLOC_LIBRARIES - NAMES jemalloc - HINTS ${JEMALLOC_ROOT_DIR}/lib) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(jemalloc DEFAULT_MSG JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR) - -mark_as_advanced( - JEMALLOC_LIBRARIES - JEMALLOC_INCLUDE_DIR) - -if (JEMALLOC_FOUND) - add_library(jemalloc::jemalloc UNKNOWN IMPORTED) - set_target_properties(jemalloc::jemalloc PROPERTIES - IMPORTED_LOCATION ${JEMALLOC_LIBRARIES} - INTERFACE_INCLUDE_DIRECTORIES "${JEMALLOC_INCLUDE_DIR}") -endif() diff --git a/cmake/generic.cmake b/cmake/generic.cmake index 3e3a5ba66c8..67f22a30279 100644 --- a/cmake/generic.cmake +++ b/cmake/generic.cmake @@ -115,10 +115,6 @@ function(common_link TARGET_NAME) if (WITH_PROFILER) target_link_libraries(${TARGET_NAME} gperftools::profiler) endif() - - if (WITH_JEMALLOC) - target_link_libraries(${TARGET_NAME} jemalloc::jemalloc) - endif() endfunction() diff --git a/paddle/fluid/memory/allocation/legacy_allocator.cc b/paddle/fluid/memory/allocation/legacy_allocator.cc index 4adc0aabf4f..f7938ce4b43 100644 --- a/paddle/fluid/memory/allocation/legacy_allocator.cc +++ b/paddle/fluid/memory/allocation/legacy_allocator.cc @@ -17,10 +17,6 @@ #include #include -#ifdef PADDLE_WITH_JEMALLOC -#include -#endif - #include "glog/logging.h" #include "paddle/fluid/memory/allocation/legacy_allocator.h" #include "paddle/fluid/memory/detail/buddy_allocator.h" @@ -103,11 +99,7 @@ struct NaiveAllocator { template <> void *Alloc(const platform::CPUPlace &place, size_t size) { VLOG(10) << "Allocate " << size << " bytes on " << platform::Place(place); -#ifdef PADDLE_WITH_JEMALLOC - void *p = malloc(size); -#else void *p = GetCPUBuddyAllocator()->Alloc(size); -#endif if (FLAGS_init_allocated_mem) { memset(p, 0xEF, size); } @@ -119,21 +111,12 @@ template <> void Free(const platform::CPUPlace &place, void *p, size_t size) { VLOG(10) << "Free pointer=" << p << " on " << platform::Place(place); -#ifdef PADDLE_WITH_JEMALLOC - free(p); -#else GetCPUBuddyAllocator()->Free(p); -#endif } template <> size_t Used(const platform::CPUPlace &place) { -#ifdef PADDLE_WITH_JEMALLOC - // fake the result of used memory when PADDLE_WITH_JEMALLOC is ON - return 0U; -#else return GetCPUBuddyAllocator()->Used(); -#endif } #ifdef PADDLE_WITH_CUDA diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index e5e1ef6c25e..ad436e4189d 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -207,7 +207,6 @@ function cmake_base() { -DANAKIN_BUILD_CROSS_PLANTFORM=${ANAKIN_BUILD_CROSS_PLANTFORM:ON} -DPY_VERSION=${PY_VERSION:-2.7} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX:-/paddle/build} - -DWITH_JEMALLOC=${WITH_JEMALLOC:-OFF} -DWITH_GRPC=${grpc_flag} ======================================== EOF @@ -242,7 +241,6 @@ EOF -DANAKIN_BUILD_CROSS_PLANTFORM=${ANAKIN_BUILD_CROSS_PLANTFORM:ON}\ -DPY_VERSION=${PY_VERSION:-2.7} \ -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX:-/paddle/build} \ - -DWITH_JEMALLOC=${WITH_JEMALLOC:-OFF} \ -DWITH_GRPC=${grpc_flag} } -- GitLab