From 09a4799a742d4b16cd418afa1598f2280610ca91 Mon Sep 17 00:00:00 2001 From: Bettina Heim Date: Mon, 28 Sep 2020 09:53:20 -0700 Subject: [PATCH] check to limit nr of threads for small problems --- src/Simulation/Native/src/external/fused.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Simulation/Native/src/external/fused.hpp b/src/Simulation/Native/src/external/fused.hpp index 2b170461e41..fdde401785f 100644 --- a/src/Simulation/Native/src/external/fused.hpp +++ b/src/Simulation/Native/src/external/fused.hpp @@ -145,7 +145,10 @@ class Fused if (envNT == NULL) { // If the user didn't force the number of threads, make an intelligent guess int nMaxThrds = std::thread::hardware_concurrency(); // Logical HW threads if (nMaxThrds > 4) nMaxThrds/= 2; // Assume we have hyperthreading (no consistent/concise way to do this) - if (wfnCapacity < 1u << 20) { + if (wfnCapacity < 1ul << 14) nMaxThrds = 1; + else if (wfnCapacity < 1ul << 16) nMaxThrds = 2; + else if (wfnCapacity < 1ul << 20) + { if (nMaxThrds > 8) nMaxThrds = 8; // Small problem, never use too many else if (nMaxThrds > 3) nMaxThrds = 3; // Small problem on a small machine }