From aaa415996edf3f019c49bb0eba0040932eab75b8 Mon Sep 17 00:00:00 2001 From: Yifei Feng Date: Thu, 20 Jun 2019 13:35:11 -0700 Subject: [PATCH] Automated rollback of commit 92511b345c7fb72217cdb36bc0251596a9c68319 PiperOrigin-RevId: 254261347 --- tensorflow/core/common_runtime/local_device.cc | 8 +++++++- tensorflow/core/platform/cpu_info.h | 5 ----- tensorflow/core/platform/posix/port.cc | 10 ---------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/tensorflow/core/common_runtime/local_device.cc b/tensorflow/core/common_runtime/local_device.cc index 84f3eca532d..0bdefd6ddab 100644 --- a/tensorflow/core/common_runtime/local_device.cc +++ b/tensorflow/core/common_runtime/local_device.cc @@ -81,7 +81,13 @@ struct LocalDevice::EigenThreadPoolInfo { intra_op_parallelism_threads = env_num_threads; // If no session setting or environment, compute a reasonable default. if (intra_op_parallelism_threads == 0) { - intra_op_parallelism_threads = port::MaxParallelism(numa_node); + intra_op_parallelism_threads = port::NumSchedulableCPUs(); + if (numa_node != port::kNUMANoAffinity) { + // Assume that CPUs are equally distributed over available NUMA nodes. + // This may not be true, but there isn't currently a better way of + // determining the number of CPUs specific to the requested node. + intra_op_parallelism_threads /= port::NUMANumNodes(); + } } } ThreadOptions thread_opts; diff --git a/tensorflow/core/platform/cpu_info.h b/tensorflow/core/platform/cpu_info.h index b2d0f21fe7a..fd76047edc5 100644 --- a/tensorflow/core/platform/cpu_info.h +++ b/tensorflow/core/platform/cpu_info.h @@ -46,11 +46,6 @@ int NumSchedulableCPUs(); // called during initialization, i.e., before before main() has started. int MaxParallelism(); -// Returns an estimate for the maximum parallelism for this process on the -// provided numa node, or any numa node if `numa_node` is kNUMANoAffinity. -// See MaxParallelism() for more information. -int MaxParallelism(int numa_node); - // Returns the total number of CPUs on the system. This number should // not change even if the underlying cluster management software may // change the number of schedulable CPUs. Unlike `NumSchedulableCPUs`, if the diff --git a/tensorflow/core/platform/posix/port.cc b/tensorflow/core/platform/posix/port.cc index a3699de965a..13a904295c1 100644 --- a/tensorflow/core/platform/posix/port.cc +++ b/tensorflow/core/platform/posix/port.cc @@ -82,16 +82,6 @@ int NumSchedulableCPUs() { int MaxParallelism() { return NumSchedulableCPUs(); } -int MaxParallelism(int numa_node) { - if (numa_node != port::kNUMANoAffinity) { - // Assume that CPUs are equally distributed over available NUMA nodes. - // This may not be true, but there isn't currently a better way of - // determining the number of CPUs specific to the requested node. - return NumSchedulableCPUs() / port::NUMANumNodes(); - } - return NumSchedulableCPUs(); -} - int NumTotalCPUs() { int count = absl::base_internal::NumCPUs(); return (count <= 0) ? kUnknownCPU : count;