diff --git a/mace/core/runtime/cpu/cpu_runtime.cc b/mace/core/runtime/cpu/cpu_runtime.cc index f9baac6e6cf528e3bf58f779ead99ab8bca18db0..89c5720604eef730eb1a5a5b48310e27d99de136 100644 --- a/mace/core/runtime/cpu/cpu_runtime.cc +++ b/mace/core/runtime/cpu/cpu_runtime.cc @@ -223,7 +223,7 @@ MaceStatus CPURuntime::SetOpenMPThreadsAndAffinityPolicy( } ++cores_to_use; } - num_threads_hint = cores_to_use; + num_threads_hint = std::min(num_threads_hint, cores_to_use); } else { cores_to_use = num_threads_hint; }