In order to improve multi-threading, it would be very nice to bind threads to particular (hardware) CPU code.
For example, thread 0 runs on core 0, thread 1 on core 2 (to skip the logical core), so on.
This would allow to skip the inefficient/logical cores and bolster up the performance.
Most importantly, it would allow to assign different sets of CPU cores to different processes which use MPSolve. Now, if we run several processes with MPSolve - we see heavy collision, threads are fighting for the same CPU cores.
Overall it would be absolutely the best, if MPSolve would give end-user fine control over thread management. Most important settings to support are:
(a) How many threads to use.
(b) What threads run of what cores (e.g. user can provide map threadID -> coreID).
There is a function mps_thread_pool_set_concurrency_limit (it controls the number of threads to use) but currently it is not part of public interface for libmps library. So that question (a) is answered to some degree.
Would it be possible to add thread map parameter to the function to resolve question (b)?
Note.
OpenMP allows setting thread affinity by environment variables. Unfortunately pthreads doesn't allow this and thread affinity control must be implemented in each end-user software.
Ok. We can use operating system affinity schedulers to force process to use only designated cores (taskset on GNU Linux and start /affinity on Windows), which makes question (b) non-relevant.
This is feature request/suggestion.
In order to improve multi-threading, it would be very nice to bind threads to particular (hardware) CPU code. For example, thread 0 runs on core 0, thread 1 on core 2 (to skip the logical core), so on.
This would allow to skip the inefficient/logical cores and bolster up the performance.
Most importantly, it would allow to assign different sets of CPU cores to different processes which use MPSolve. Now, if we run several processes with MPSolve - we see heavy collision, threads are fighting for the same CPU cores.
The
OpenMP
hasKMP_AFFINITY
,OMP_PLACES
andOMP_PROC_BIND.
Thepthreads
provides similar functionality for threads affinity control: https://stackoverflow.com/questions/25472441/pthread-affinity-before-create-threadsOverall it would be absolutely the best, if MPSolve would give end-user fine control over thread management. Most important settings to support are: (a) How many threads to use. (b) What threads run of what cores (e.g. user can provide map threadID -> coreID).
There is a function
mps_thread_pool_set_concurrency_limit
(it controls the number of threads to use) but currently it is not part of public interface for libmps library. So that question (a) is answered to some degree.Would it be possible to add thread map parameter to the function to resolve question (b)?
Note.
OpenMP
allows setting thread affinity by environment variables. Unfortunatelypthreads
doesn't allow this and thread affinity control must be implemented in each end-user software.