aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core
diff options
context:
space:
mode:
authorGravatar Ayush Dubey <ayushd@google.com>2018-10-01 15:26:59 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-01 15:33:13 -0700
commit52574f95279d8cd5ec22cfc24668b9586e41367a (patch)
tree3de4c1f67b52dce3131dac2cbb21af768d25ff12 /tensorflow/core
parentcca204f12a5838f0ffdd4a80c27d451cf61d3636 (diff)
Remove jemalloc build files and dead configuration options.
PiperOrigin-RevId: 215291195
Diffstat (limited to 'tensorflow/core')
-rw-r--r--tensorflow/core/platform/default/build_config.bzl20
-rw-r--r--tensorflow/core/platform/posix/port.cc36
-rw-r--r--tensorflow/core/platform/windows/port.cc51
3 files changed, 11 insertions, 96 deletions
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);