| get_recommended_threads | R Documentation |
Returns a recommended number of threads for parallel operations, based on available CPU cores and system load.
get_recommended_threads(use_fraction = 0.8)
use_fraction |
Numeric. Fraction of available cores to use (default 0.8). Using all cores (1.0) may overload the system. |
This function uses the C++ implementation to detect CPU cores and returns a conservative estimate leaving room for the OS and other processes.
Default behavior (use_fraction = 0.8):
4 cores → 3 threads
8 cores → 6 threads
16 cores → 13 threads
Integer with recommended number of threads (minimum 1)
get_cpu_cores
# Get recommended threads
threads <- get_recommended_threads()
# Use for OpenMP operations
options(BigDataStatMeth.threads = threads)
# More aggressive (use 90% of cores)
threads <- get_recommended_threads(use_fraction = 0.9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.