cimg.openmp {imager} | R Documentation |
Control CImg's parallelisation
Description
On supported architectures CImg can parallelise many operations using OpenMP (e.g. imager.combine
). Use this function to turn parallelisation on or off.
Usage
cimg.use.openmp(mode = "adaptive", nthreads = 1, verbose = FALSE)
cimg.limit.openmp()
Arguments
mode |
Either "adaptive","always" or "none". The default is adaptive (parallelisation for large images only). |
nthreads |
The number of OpenMP threads that imager should use. The default is 1. Set to 0 to get no more than 2, based on OpenMP environment variables. |
verbose |
Whether to output information about the threads being set. |
Details
You need to be careful that nthreads is not higher than the value in the system environment variable OMP_THREAD_LIMIT (this can be checked with Sys.getenv('OMP_THREAD_LIMIT')). The OMP_THREAD_LIMIT thread limit usually needs to be correctly set before launching R, so using Sys.setenv once a session has started is not certain to work.
Value
NULL (function is used for side effects)
Functions
-
cimg.limit.openmp()
: Limit OpenMP thread count to no more than 2, based on OpenMP environment variables.
Author(s)
Simon Barthelme
Examples
cimg.use.openmp("never") #turn off parallelisation