On supported architectures CImg can parallelise many operations using OpenMP (e.g. imager.combine). Use this function to turn parallelisation on or off.
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.
Functions
cimg.limit.openmp(): Limit OpenMP thread count to no more than 2, based on OpenMP environment variables.
Author
Simon Barthelme
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.