diff options
author | Ayush Dubey <ayushd@google.com> | 2018-10-01 15:26:59 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-10-01 15:33:13 -0700 |
commit | 52574f95279d8cd5ec22cfc24668b9586e41367a (patch) | |
tree | 3de4c1f67b52dce3131dac2cbb21af768d25ff12 /tensorflow | |
parent | cca204f12a5838f0ffdd4a80c27d451cf61d3636 (diff) |
Remove jemalloc build files and dead configuration options.
PiperOrigin-RevId: 215291195
Diffstat (limited to 'tensorflow')
-rw-r--r-- | tensorflow/BUILD | 39 | ||||
-rw-r--r-- | tensorflow/contrib/cmake/CMakeLists.txt | 11 | ||||
-rw-r--r-- | tensorflow/contrib/cmake/external/jemalloc.cmake | 50 | ||||
-rw-r--r-- | tensorflow/core/platform/default/build_config.bzl | 20 | ||||
-rw-r--r-- | tensorflow/core/platform/posix/port.cc | 36 | ||||
-rw-r--r-- | tensorflow/core/platform/windows/port.cc | 51 | ||||
-rw-r--r-- | tensorflow/tools/lib_package/BUILD | 16 | ||||
-rw-r--r-- | tensorflow/tools/pip_package/BUILD | 8 | ||||
-rwxr-xr-x | tensorflow/workspace.bzl | 12 |
9 files changed, 11 insertions, 232 deletions
diff --git a/tensorflow/BUILD b/tensorflow/BUILD index 4876b51a6f..9b62a50452 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -203,21 +203,6 @@ config_setting( visibility = ["//visibility:public"], ) -# TODO(jhseu): Enable on other platforms other than Linux. -config_setting( - name = "with_jemalloc_linux_x86_64", - define_values = {"with_jemalloc": "true"}, - values = {"cpu": "k8"}, - visibility = ["//visibility:public"], -) - -config_setting( - name = "with_jemalloc_linux_ppc64le", - define_values = {"with_jemalloc": "true"}, - values = {"cpu": "ppc"}, - visibility = ["//visibility:public"], -) - config_setting( name = "with_default_optimizations", define_values = {"with_default_optimizations": "true"}, @@ -266,30 +251,6 @@ config_setting( ) config_setting( - name = "with_jemalloc_linux_x86_64_dynamic", - define_values = { - "with_jemalloc": "true", - "framework_shared_object": "true", - }, - values = { - "cpu": "k8", - }, - visibility = ["//visibility:public"], -) - -config_setting( - name = "with_jemalloc_linux_ppc64le_dynamic", - define_values = { - "with_jemalloc": "true", - "framework_shared_object": "true", - }, - values = { - "cpu": "ppc", - }, - visibility = ["//visibility:public"], -) - -config_setting( name = "using_cuda_clang", define_values = { "using_cuda_clang": "true", diff --git a/tensorflow/contrib/cmake/CMakeLists.txt b/tensorflow/contrib/cmake/CMakeLists.txt index c6d6f04168..f675c135f4 100644 --- a/tensorflow/contrib/cmake/CMakeLists.txt +++ b/tensorflow/contrib/cmake/CMakeLists.txt @@ -30,7 +30,6 @@ endif() option(tensorflow_ENABLE_GRPC_SUPPORT "Enable gRPC support" ON) option(tensorflow_ENABLE_HDFS_SUPPORT "Enable HDFS support" OFF) -option(tensorflow_ENABLE_JEMALLOC_SUPPORT "Enable jemalloc support" OFF) option(tensorflow_BUILD_CC_EXAMPLE "Build the C++ tutorial example" ON) option(tensorflow_BUILD_PYTHON_BINDINGS "Build the Python bindings" ON) option(tensorflow_BUILD_ALL_KERNELS "Build all OpKernels" ON) @@ -218,10 +217,6 @@ if (tensorflow_WIN_CPU_SIMD_OPTIONS) endif() endif() -if (tensorflow_ENABLE_JEMALLOC_SUPPORT) - add_definitions(-DTENSORFLOW_USE_JEMALLOC -DJEMALLOC_EXPORT=) -endif() - # External dependencies include(zlib) include(gif) @@ -329,12 +324,6 @@ if(tensorflow_ENABLE_GRPC_SUPPORT) list(APPEND tensorflow_EXTERNAL_DEPENDENCIES boringssl) endif() endif() -if(tensorflow_ENABLE_JEMALLOC_SUPPORT) - include(jemalloc) - list(APPEND tensorflow_EXTERNAL_LIBRARIES ${jemalloc_STATIC_LIBRARIES}) - list(APPEND tensorflow_EXTERNAL_DEPENDENCIES jemalloc) - include_directories(${jemalloc_INCLUDE_DIRS}) -endif() if(tensorflow_ENABLE_SNAPPY_SUPPORT) include(snappy) list(APPEND tensorflow_EXTERNAL_LIBRARIES ${snappy_STATIC_LIBRARIES}) diff --git a/tensorflow/contrib/cmake/external/jemalloc.cmake b/tensorflow/contrib/cmake/external/jemalloc.cmake deleted file mode 100644 index afadcc007d..0000000000 --- a/tensorflow/contrib/cmake/external/jemalloc.cmake +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2017 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== -include (ExternalProject) - -set(jemalloc_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/jemalloc/src/jemalloc/include) -set(jemalloc_URL https://mirror.bazel.build/github.com/jemalloc/jemalloc-cmake/archive/jemalloc-cmake.4.3.1.tar.gz) -set(jemalloc_HASH SHA256=f9be9a05fe906deb5c1c8ca818071a7d2e27d66fd87f5ba9a7bf3750bcedeaf0) -set(jemalloc_BUILD ${CMAKE_CURRENT_BINARY_DIR}/jemalloc/src/jemalloc) - -if (WIN32) - set(jemalloc_INCLUDE_DIRS - ${jemalloc_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR}/jemalloc/src/jemalloc/include/msvc_compat - ) - if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") - set(jemalloc_STATIC_LIBRARIES ${jemalloc_BUILD}/Release/jemalloc.lib) - else() - set(jemalloc_STATIC_LIBRARIES ${jemalloc_BUILD}/jemalloc.lib) - endif() -else() - set(jemalloc_STATIC_LIBRARIES ${jemalloc_BUILD}/Release/jemalloc.a) -endif() - -ExternalProject_Add(jemalloc - PREFIX jemalloc - URL ${jemalloc_URL} - URL_HASH ${jemalloc_HASH} - DOWNLOAD_DIR "${DOWNLOAD_LOCATION}" - BUILD_IN_SOURCE 1 - BUILD_BYPRODUCTS ${jemalloc_STATIC_LIBRARIES} - BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release --target jemalloc - INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step." - CMAKE_CACHE_ARGS - -DCMAKE_BUILD_TYPE:STRING=Release - -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF - -Dwith-jemalloc-prefix:STRING=jemalloc_ - -Dwithout-export:BOOL=ON -) diff --git a/tensorflow/core/platform/default/build_config.bzl b/tensorflow/core/platform/default/build_config.bzl index 3b14757945..d884c1aa7c 100644 --- a/tensorflow/core/platform/default/build_config.bzl +++ b/tensorflow/core/platform/default/build_config.bzl @@ -615,11 +615,7 @@ def tf_kernel_tests_linkstatic(): def tf_additional_lib_defines(): """Additional defines needed to build TF libraries.""" - return select({ - "//tensorflow:with_jemalloc_linux_x86_64": ["TENSORFLOW_USE_JEMALLOC"], - "//tensorflow:with_jemalloc_linux_ppc64le": ["TENSORFLOW_USE_JEMALLOC"], - "//conditions:default": [], - }) + return [] def tf_additional_lib_deps(): """Additional dependencies needed to build TF libraries.""" @@ -631,13 +627,7 @@ def tf_additional_lib_deps(): ] + if_static( ["@nsync//:nsync_cpp"], ["@nsync//:nsync_headers"], - ) + select({ - "//tensorflow:with_jemalloc_linux_x86_64_dynamic": ["@jemalloc//:jemalloc_headers"], - "//tensorflow:with_jemalloc_linux_ppc64le_dynamic": ["@jemalloc//:jemalloc_headers"], - "//tensorflow:with_jemalloc_linux_x86_64": ["@jemalloc//:jemalloc_impl"], - "//tensorflow:with_jemalloc_linux_ppc64le": ["@jemalloc//:jemalloc_impl"], - "//conditions:default": [], - }) + ) def tf_additional_core_deps(): return select({ @@ -725,11 +715,7 @@ def tf_additional_binary_deps(): "//tensorflow/stream_executor:cuda_platform", "//tensorflow/core/platform/default/build_config:cuda", ], - ) + select({ - "//tensorflow:with_jemalloc_linux_x86_64": ["@jemalloc//:jemalloc_impl"], - "//tensorflow:with_jemalloc_linux_ppc64le": ["@jemalloc//:jemalloc_impl"], - "//conditions:default": [], - }) + [ + ) + [ # TODO(allenl): Split these out into their own shared objects (they are # here because they are shared between contrib/ op shared objects and # core). diff --git a/tensorflow/core/platform/posix/port.cc b/tensorflow/core/platform/posix/port.cc index b46b9927cd..acdd7798ea 100644 --- a/tensorflow/core/platform/posix/port.cc +++ b/tensorflow/core/platform/posix/port.cc @@ -13,10 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#ifdef TENSORFLOW_USE_JEMALLOC -#include "jemalloc/jemalloc.h" -#endif - #include "absl/base/internal/sysinfo.h" #include "tensorflow/core/platform/cpu_info.h" @@ -101,11 +97,7 @@ void* AlignedMalloc(size_t size, int minimum_alignment) { // memory aligned to at least the size of a pointer. const int required_alignment = sizeof(void*); if (minimum_alignment < required_alignment) return Malloc(size); -#ifdef TENSORFLOW_USE_JEMALLOC - int err = jemalloc_posix_memalign(&ptr, minimum_alignment, size); -#else int err = posix_memalign(&ptr, minimum_alignment, size); -#endif if (err != 0) { return nullptr; } else { @@ -116,29 +108,11 @@ void* AlignedMalloc(size_t size, int minimum_alignment) { void AlignedFree(void* aligned_memory) { Free(aligned_memory); } -void* Malloc(size_t size) { -#ifdef TENSORFLOW_USE_JEMALLOC - return jemalloc_malloc(size); -#else - return malloc(size); -#endif -} +void* Malloc(size_t size) { return malloc(size); } -void* Realloc(void* ptr, size_t size) { -#ifdef TENSORFLOW_USE_JEMALLOC - return jemalloc_realloc(ptr, size); -#else - return realloc(ptr, size); -#endif -} +void* Realloc(void* ptr, size_t size) { return realloc(ptr, size); } -void Free(void* ptr) { -#ifdef TENSORFLOW_USE_JEMALLOC - jemalloc_free(ptr); -#else - free(ptr); -#endif -} +void Free(void* ptr) { free(ptr); } void* NUMAMalloc(int node, size_t size, int minimum_alignment) { return AlignedMalloc(size, minimum_alignment); @@ -146,9 +120,7 @@ void* NUMAMalloc(int node, size_t size, int minimum_alignment) { void NUMAFree(void* ptr, size_t size) { Free(ptr); } -int NUMAGetMemAffinity(const void* addr) { - return kNUMANoAffinity; -} +int NUMAGetMemAffinity(const void* addr) { return kNUMANoAffinity; } void MallocExtension_ReleaseToSystem(std::size_t num_bytes) { // No-op. diff --git a/tensorflow/core/platform/windows/port.cc b/tensorflow/core/platform/windows/port.cc index 5375f56372..911ea1902f 100644 --- a/tensorflow/core/platform/windows/port.cc +++ b/tensorflow/core/platform/windows/port.cc @@ -13,10 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#ifdef TENSORFLOW_USE_JEMALLOC -#include "jemalloc/jemalloc.h" -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -70,55 +66,16 @@ void NUMASetThreadNodeAffinity(int node) {} int NUMAGetThreadNodeAffinity() { return kNUMANoAffinity; } void* AlignedMalloc(size_t size, int minimum_alignment) { -#ifdef TENSORFLOW_USE_JEMALLOC - void* ptr = NULL; - // posix_memalign requires that the requested alignment be at least - // sizeof(void*). In this case, fall back on malloc which should return - // memory aligned to at least the size of a pointer. - const int required_alignment = sizeof(void*); - if (minimum_alignment < required_alignment) return Malloc(size); - int err = jemalloc_posix_memalign(&ptr, minimum_alignment, size); - if (err != 0) { - return NULL; - } else { - return ptr; - } -#else return _aligned_malloc(size, minimum_alignment); -#endif } -void AlignedFree(void* aligned_memory) { -#ifdef TENSORFLOW_USE_JEMALLOC - jemalloc_free(aligned_memory); -#else - _aligned_free(aligned_memory); -#endif -} +void AlignedFree(void* aligned_memory) { _aligned_free(aligned_memory); } -void* Malloc(size_t size) { -#ifdef TENSORFLOW_USE_JEMALLOC - return jemalloc_malloc(size); -#else - return malloc(size); -#endif -} +void* Malloc(size_t size) { return malloc(size); } -void* Realloc(void* ptr, size_t size) { -#ifdef TENSORFLOW_USE_JEMALLOC - return jemalloc_realloc(ptr, size); -#else - return realloc(ptr, size); -#endif -} +void* Realloc(void* ptr, size_t size) { return realloc(ptr, size); } -void Free(void* ptr) { -#ifdef TENSORFLOW_USE_JEMALLOC - return jemalloc_free(ptr); -#else - return free(ptr); -#endif -} +void Free(void* ptr) { return free(ptr); } void* NUMAMalloc(int node, size_t size, int minimum_alignment) { return AlignedMalloc(size, minimum_alignment); diff --git a/tensorflow/tools/lib_package/BUILD b/tensorflow/tools/lib_package/BUILD index b9f4902639..85514b8629 100644 --- a/tensorflow/tools/lib_package/BUILD +++ b/tensorflow/tools/lib_package/BUILD @@ -137,14 +137,6 @@ genrule( "@snappy//:COPYING", "@zlib_archive//:zlib.h", ] + select({ - "//tensorflow:with_jemalloc_linux_x86_64": [ - "@jemalloc//:COPYING", - ], - "//tensorflow:with_jemalloc_linux_ppc64le": [ - "@jemalloc//:COPYING", - ], - "//conditions:default": [], - }) + select({ "//tensorflow/core/kernels:xsmm": [ "@libxsmm_archive//:LICENSE.md", ], @@ -202,14 +194,6 @@ genrule( "@snappy//:COPYING", "@zlib_archive//:zlib.h", ] + select({ - "//tensorflow:with_jemalloc_linux_x86_64": [ - "@jemalloc//:COPYING", - ], - "//tensorflow:with_jemalloc_linux_ppc64le": [ - "@jemalloc//:COPYING", - ], - "//conditions:default": [], - }) + select({ "//tensorflow/core/kernels:xsmm": [ "@libxsmm_archive//:LICENSE.md", ], diff --git a/tensorflow/tools/pip_package/BUILD b/tensorflow/tools/pip_package/BUILD index c621812535..3a1c4a45d4 100644 --- a/tensorflow/tools/pip_package/BUILD +++ b/tensorflow/tools/pip_package/BUILD @@ -167,14 +167,6 @@ filegroup( "@zlib_archive//:zlib.h", "@org_python_pypi_backports_weakref//:LICENSE", ] + select({ - "//tensorflow:with_jemalloc_linux_x86_64": [ - "@jemalloc//:COPYING", - ], - "//tensorflow:with_jemalloc_linux_ppc64le": [ - "@jemalloc//:COPYING", - ], - "//conditions:default": [], - }) + select({ "//tensorflow/core/kernels:xsmm": [ "@libxsmm_archive//:LICENSE.md", ], diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 9b4b698874..bcc89ef729 100755 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -642,18 +642,6 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""): testonly_ = True, ) - tf_http_archive( - name = "jemalloc", - build_file = clean_dep("//third_party:jemalloc.BUILD"), - sha256 = "3c8f25c02e806c3ce0ab5fb7da1817f89fc9732709024e2a81b6b82f7cc792a8", - strip_prefix = "jemalloc-4.4.0", - system_build_file = clean_dep("//third_party/systemlibs:jemalloc.BUILD"), - urls = [ - "https://mirror.bazel.build/github.com/jemalloc/jemalloc/archive/4.4.0.tar.gz", - "https://github.com/jemalloc/jemalloc/archive/4.4.0.tar.gz", - ], - ) - java_import_external( name = "com_google_testing_compile", jar_sha256 = "edc180fdcd9f740240da1a7a45673f46f59c5578d8cd3fbc912161f74b5aebb8", |