Automated rollback of commit 92511b345c

PiperOrigin-RevId: 254424050
This commit is contained in:
A. Unique TensorFlower 2019-06-21 10:33:19 -07:00 committed by TensorFlower Gardener
parent 8497cc4ebd
commit 3842f749bc
4 changed files with 26 additions and 7 deletions

View File

@ -81,13 +81,7 @@ 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::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();
}
intra_op_parallelism_threads = port::MaxParallelism(numa_node);
}
}
ThreadOptions thread_opts;

View File

@ -46,6 +46,11 @@ 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

View File

@ -82,6 +82,16 @@ 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;

View File

@ -57,6 +57,16 @@ 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() {
// TODO(ebrevdo): Make this more accurate.
//