R/hpc_threads.R
detect_hpc_cores.RdInspects 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()An integer representing the recommended number of worker threads.
cores <- detect_hpc_cores()
message("Detected allocated cores: ", cores)
#> Detected allocated cores: 4