11.2 Using Multiple Threads in an Optimizer¶
Multithreading in interior-point optimizers
The interior-point optimizers in MOSEK have been parallelized. This means that if you solve linear, quadratic, conic, or general convex optimization problem using the interior-point optimizer, you can take advantage of multiple CPU’s. By default MOSEK will automatically select the number of threads to be employed when solving the problem. However, the maximum number of threads employed can be changed by setting the parameter
MSK_IPAR_NUM_THREADS. This should never exceed the number of cores on the computer.
The speed-up obtained when using multiple threads is highly problem and hardware dependent, and consequently, it is advisable to compare single threaded and multi threaded performance for the given problem type to determine the optimal settings. For small problems, using multiple threads is not be worthwhile and may even be counter productive because of the additional coordination overhead. Therefore, it may be advantageous to disable multithreading using the parameter
The interior-point optimizer parallelizes big tasks such linear algebra computations.
The MOSEK API is thread-safe provided that a task is only modified or accessed from one thread at any given time. Also accessing two or more separate tasks from threads at the same time is safe. Sharing an environment between threads is safe.
The optimizers are run-to-run deterministic which means if a problem is solved twice on the same computer using the same parameter setting and exactly the same input then exactly the same results is obtained. One restriction is that no time limits must be imposed because the time taken to perform an operation on a computer is dependent on many factors such as the current workload.