From b865e80c2f0b3aaf4afe695da305a28f6b37deae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20T=C3=B3th?= Date: Wed, 8 Jan 2025 14:39:30 +0100 Subject: [PATCH] Set limit to the number of threads if it is unset when we ask for the number. --- opm/simulators/flow/Main.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opm/simulators/flow/Main.hpp b/opm/simulators/flow/Main.hpp index d4e5b2889..e704f3d29 100644 --- a/opm/simulators/flow/Main.hpp +++ b/opm/simulators/flow/Main.hpp @@ -731,6 +731,9 @@ private: std::cout << ("Warning: Invalid value for OMP_NUM_THREADS environment variable.") << std::endl; } } + } else { + // Set a limit to OMP threads. Defaults can saturate the whole machine. + omp_set_num_threads(threads); } first_time = false;