-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default threads number value should use sched_getaffinity #925
Comments
You can't currently use affinity with MMseqs2. The issue AFAIK is that we use multi stage execution that doesn't play well with affinity. When you call a MMseqs2 workflow (e.g. |
Hello, thank you for your answer. I'm sorry if I got it wrong, but the suggestion was not to use affinity. It is about using sched_getaffinity primitive to get the number of cores accessible to the process and child processes and not which one to use. This number will only be used as the default thread number, and nothing else. To illustrate further, here is the search help output through slurm requesting only one core on a 96 cores machines:
It really should be [1] instead of [96] here (since I requested one core in the slurm srun command), because it would use 96 cores on a single core.
Inverting the test in the I hope it makes more sense now. Thank you ! |
Ah, sorry for the misunderstanding. That is a good idea |
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
Hello,
default thread value are computed from Parameters::setDefaults
MMseqs2/src/commons/Parameters.cpp
Line 2298 in b0e91c1
If you run mmseqs on a 96 cores machines with taskset -c 1 or a slurm allocation with a single core requested, mmseqs will use 96 threads on a single core which is unfortunate.
Here is a reproducer:
From a machine with a single 64 cores cpu with HT activated:
Using taskset:
Same program submitted through slurm on a 96 cores server (HT off) with a single core requested (-c 1):
The problem with this code is that sysconf(_SC_NPROCESSORS_ONLN) corresponds to the hardware cores count and not the available core to the running process. The omp pragma is working correctly.
I think a more sane behavior for mmseqs would be to use sched_getaffinity as in the folly library from facebook for example (folly/folly/system/HardwareConcurrency.cpp)
This is similar to bshoshany/thread-pool#161 for example.
Thank you for considering this change !
Jean-Baptiste
The text was updated successfully, but these errors were encountered: