Inspects environment variables set by HPC cluster schedulers (Slurm, PBS, SGE/Grid Engine) as well as OpenMP and Rayon variables. If no scheduler quota is found, falls back to physical core detection via parallel::detectCores().

detect_hpc_cores()

Value

An integer representing the recommended number of worker threads.

Examples

cores <- detect_hpc_cores()
message("Detected allocated cores: ", cores)
#> Detected allocated cores: 4