Multithreading

Currently a few of PySTE’s functions support multithreading. By default multithreading is turned off. This is because it is typically more efficient to parallelise a program at the highest level—for example, a loop over propagate(). However, if there will be times when PySTE function calls cannot be parallelised. In this case it makes sense to turn on multithreading. This can be done using set_threads(). For example

will allow PySTE to parallelise using 2 threads. Multithreading can be turned off again using:

py_ste.set_threads(1)

If you wish to check how many threads are currently set to be used you can call get_threads().

The functions that currently support multithreading are:

Warning

The number of threads should be less than or equal to the number of physical cores and you should not attempt to make use of hyperthreading by using twice the number of physical cores. PySTE uses Eigen3 for multithreading which provides the following warning:

Quote

On most OS it is very important to limit the number of threads to the number of physical cores, otherwise significant slowdowns are expected

For more details see https://eigen.tuxfamily.org/dox/TopicMultiThreading.html.


Previous | Next