Skip to content

Commit

Permalink
Remove jemalloc build files and dead configuration options.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 215291195
  • Loading branch information
dubey authored and tensorflower-gardener committed Oct 1, 2018
1 parent cca204f commit 52574f9
Show file tree
Hide file tree
Showing 14 changed files with 11 additions and 622 deletions.
2 changes: 0 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,6 @@ def main():
setup_python(environ_cp)

if is_windows():
environ_cp['TF_NEED_JEMALLOC'] = '0'
environ_cp['TF_NEED_OPENCL_SYCL'] = '0'
environ_cp['TF_NEED_COMPUTECPP'] = '0'
environ_cp['TF_NEED_OPENCL'] = '0'
Expand All @@ -1507,7 +1506,6 @@ def main():
environ_cp['TF_SET_ANDROID_WORKSPACE'] = '0'

if is_macos():
environ_cp['TF_NEED_JEMALLOC'] = '0'
environ_cp['TF_NEED_TENSORRT'] = '0'
environ_cp['TF_ENABLE_XLA'] = '0'

Expand Down
39 changes: 0 additions & 39 deletions tensorflow/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down Expand Up @@ -265,30 +250,6 @@ config_setting(
visibility = ["//visibility:public"],
)

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 = {
Expand Down
11 changes: 0 additions & 11 deletions tensorflow/contrib/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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})
Expand Down
50 changes: 0 additions & 50 deletions tensorflow/contrib/cmake/external/jemalloc.cmake

This file was deleted.

20 changes: 3 additions & 17 deletions tensorflow/core/platform/default/build_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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({
Expand Down Expand Up @@ -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).
Expand Down
36 changes: 4 additions & 32 deletions tensorflow/core/platform/posix/port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand All @@ -116,39 +108,19 @@ 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);
}

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.
Expand Down
51 changes: 4 additions & 47 deletions tensorflow/core/platform/windows/port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 0 additions & 16 deletions tensorflow/tools/lib_package/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
Expand Down Expand Up @@ -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",
],
Expand Down
8 changes: 0 additions & 8 deletions tensorflow/tools/pip_package/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
Expand Down
12 changes: 0 additions & 12 deletions tensorflow/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading

0 comments on commit 52574f9

Please sign in to comment.