Skip to content

Commit

Permalink
Use available cores count as default threads number
Browse files Browse the repository at this point in the history
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 soedinglab#925
  • Loading branch information
jbd authored Jan 7, 2025
1 parent 35537c4 commit 52a0a6b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/commons/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2340,12 +2340,7 @@ void Parameters::setDefaults() {
if (threadEnv != NULL) {
threads = (int) Util::fast_atoi<unsigned int>(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
Expand Down

0 comments on commit 52a0a6b

Please sign in to comment.