Skip to content

Commit aaa4159

Browse files
yifeiftensorflower-gardener
authored andcommitted
Automated rollback of commit 92511b3
PiperOrigin-RevId: 254261347
1 parent b71a4c0 commit aaa4159

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

tensorflow/core/common_runtime/local_device.cc

+7-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ struct LocalDevice::EigenThreadPoolInfo {
8181
intra_op_parallelism_threads = env_num_threads;
8282
// If no session setting or environment, compute a reasonable default.
8383
if (intra_op_parallelism_threads == 0) {
84-
intra_op_parallelism_threads = port::MaxParallelism(numa_node);
84+
intra_op_parallelism_threads = port::NumSchedulableCPUs();
85+
if (numa_node != port::kNUMANoAffinity) {
86+
// Assume that CPUs are equally distributed over available NUMA nodes.
87+
// This may not be true, but there isn't currently a better way of
88+
// determining the number of CPUs specific to the requested node.
89+
intra_op_parallelism_threads /= port::NUMANumNodes();
90+
}
8591
}
8692
}
8793
ThreadOptions thread_opts;

tensorflow/core/platform/cpu_info.h

-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ int NumSchedulableCPUs();
4646
// called during initialization, i.e., before before main() has started.
4747
int MaxParallelism();
4848

49-
// Returns an estimate for the maximum parallelism for this process on the
50-
// provided numa node, or any numa node if `numa_node` is kNUMANoAffinity.
51-
// See MaxParallelism() for more information.
52-
int MaxParallelism(int numa_node);
53-
5449
// Returns the total number of CPUs on the system. This number should
5550
// not change even if the underlying cluster management software may
5651
// change the number of schedulable CPUs. Unlike `NumSchedulableCPUs`, if the

tensorflow/core/platform/posix/port.cc

-10
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,6 @@ int NumSchedulableCPUs() {
8282

8383
int MaxParallelism() { return NumSchedulableCPUs(); }
8484

85-
int MaxParallelism(int numa_node) {
86-
if (numa_node != port::kNUMANoAffinity) {
87-
// Assume that CPUs are equally distributed over available NUMA nodes.
88-
// This may not be true, but there isn't currently a better way of
89-
// determining the number of CPUs specific to the requested node.
90-
return NumSchedulableCPUs() / port::NUMANumNodes();
91-
}
92-
return NumSchedulableCPUs();
93-
}
94-
9585
int NumTotalCPUs() {
9686
int count = absl::base_internal::NumCPUs();
9787
return (count <= 0) ? kUnknownCPU : count;

0 commit comments

Comments
 (0)