From 52a0a6b8527b5df51afcae942e971b09721f060d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Denis Date: Tue, 7 Jan 2025 16:34:26 +0100 Subject: [PATCH] Use available cores count as default threads number Use only Util::omp_thread_count() to get the number of accessible cores to the process and its children. sysconf(_SC_NPROCESSORS_ONLN) gets the hardware core count that could be different if mmseqs2 is running within a constrained environmenet (taskset, cgroups, slurm...). Resolve #925 --- src/commons/Parameters.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/commons/Parameters.cpp b/src/commons/Parameters.cpp index dd000f4c..e09afbc3 100644 --- a/src/commons/Parameters.cpp +++ b/src/commons/Parameters.cpp @@ -2340,12 +2340,7 @@ void Parameters::setDefaults() { if (threadEnv != NULL) { threads = (int) Util::fast_atoi(threadEnv); } else { - #ifdef _SC_NPROCESSORS_ONLN - threads = sysconf(_SC_NPROCESSORS_ONLN); - #endif - if(threads <= 1){ - threads = Util::omp_thread_count(); - } + threads = Util::omp_thread_count(); } #endif