|
STIR
6.3.0
|
|
Files | |
| file | num_threads.h |
| Implementation of functions related to setting/getting the number of threads. | |
Functions | |
| int | stir::get_max_num_threads () |
| Get current maximum number of threads. More... | |
| void | stir::set_num_threads (const int num_threads=0) |
| Set current number of threads. More... | |
| int | stir::get_default_num_threads () |
| Get default number of threads. More... | |
| void | stir::set_default_num_threads () |
| set current number of threads to the default More... | |
| int stir::get_max_num_threads | ( | ) |
Get current maximum number of threads.
This returns the maxmimum number of threads to be used by STIR. Usually this should be equal to what you set earlier via set_num_threads().
Currently only useful when compiled with OpenMP support. Corresponds then to omp_get_max_threads()
| void stir::set_num_threads | ( | const int | num_threads = 0 | ) |
Set current number of threads.
This can be used to increase/decrease the number of threads used by STIR from the default value (see get_default_num_threads()).
If num_threads is zero (and therefore when no arguments are passed) and if this is the first time this function is called, it will call set_default_num_threads().
Therefore, after calling set_num_threads(5), future calls to set_num_threads() will keep using 5 threads. This is used internally in STIR (e.g. in distributable_computation) to normally use the default number of threads, but let the user change it.
References stir::set_default_num_threads(), and stir::warning().
Referenced by stir::set_default_num_threads(), stir::ProjMatrixByBinSPECTUB::set_up(), stir::ProjMatrixByBinPinholeSPECTUB::set_up(), and stir::setup_distributable_computation().
| int stir::get_default_num_threads | ( | ) |
Get default number of threads.
If OpenMP support is enabled, the default is normally set from the OMP_NUM_THREADS environment variable. However, if this is is not set, we use ~90% of the available processors.
Currently only useful when compiled with OpenMP support.
Referenced by stir::set_default_num_threads().
| void stir::set_default_num_threads | ( | ) |
set current number of threads to the default
Currently only useful when compiled with OpenMP support.
References stir::get_default_num_threads(), and stir::set_num_threads().
Referenced by stir::set_num_threads().
1.8.13