parent
b71a4c0765
commit
aaa415996e
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue