rth.nthreads: Determining the Number of Threads a Routine Uses

Description Usage Details

View source: R/threads.R


Note, this only applies for OpenMP and Intel Thread Building Blocks backends.




rth.nthreads() will determine the maximum number of threads to use by checking against the environment variable RTH_NUM_THREADS (and in the case of OpenMP, OMP_NUM_THREADS), and failing that, the default for the given backend. For OpenMP this means that the number of cores (physical+logical) will be returned. For Intel Thread Building Blocks, the default is the value -1.

For any function taking nthreads= as an argument, the priority is (highest to lowest):

nthreads argument in the R-level Rth function
RTH_NUM_THREADS environment variable
OMP_NUM_THREADS environment variable (for OpenMP backends)
Number of cores

matloff/Rth documentation built on May 21, 2019, 12:55 p.m.