126. MTMODE - Multithread Mode
The MTMODE parameter controls the multithreading mode that LINGO operates in. LINGO offers multicore extensions to its model generator and solvers. The multicore extensions are of two types: concurrent and parallel. Concurrent algorithms run two or more different serial algorithms on multiple copies of the same model, using a separate thread for each algorithm, terminating as soon as the winner thread finishes. These “different algorithms” may in fact be the same algorithm type, but using different strategies and/or parameters. Parallel algorithms, on the other hand, parallelize computationally intensive portions of the serial algorithm to distribute the workload across multiple threads.
The following multicore extensions are currently available in LINGO:
LINGO Component |
Model Class |
Parallel Option |
Concurrent Option |
Barrier Solver |
Linear Programs |
Yes |
No |
BNP Solver |
Mixed Integer Programs |
Yes |
No |
Global Solver |
Nonlinear Programs |
Yes |
No |
Integer Solver |
Mixed Integer Programs |
Yes |
Yes |
Linear Solver |
Linear Programs |
No |
Yes |
Model Generator |
All |
Yes |
No |
Multistart Solver |
Nonlinear Programs |
Yes |
No |
Stochastic Solver |
Stochastic Programs |
Yes |
No |
The available settings for the Mode, or multithreading mode, parameter are as follows:
• | -1 — Solver Decides — The best available multithreading strategy, either parallel or concurrent, will be selected for each step of the solution process. |
• | 0 — Off in Solver — Multithreading will be disabled in the solvers, but allowed in the model generator if the number of threads is greater than 1. |
• | 1 — Prefer Parallel — If a parallel option is available for a particular solution step, then it will be selected, otherwise, a concurrent option will be selected when available. |
• | 2 — Parallel Only - If a parallel option is available for a particular solution step, then it will be selected, otherwise, the step will be executed in single-thread mode. |
• | 3 — Prefer Concurrent - If a concurrent option is available for a particular solution step, then it will be selected, otherwise, a parallel option will be selected when available. |
• | 4 — Concurrent Only - If a concurrent option is available for a particular solution step, then it will be selected, otherwise, the step will be executed in single-thread mode. |
Note: | If the maximum thread count parameter, NTHRDS, is set to 1, then the multithreading mode setting will be ignored, and LINGO will execute in single-threaded mode. |
Note: | Setting the maximum thread count parameter, NTHRDS, to N does not guarantee than N cores will be fully utilized throughout the entire solve. There may be serial sections inside parallel code that get executed from time to time, causing only one core to be utilized. Concurrent algorithms may also have fewer than N different serial algorithms to launch, meaning fewer than N cores will be occupied. |