availableCores: Get number of available cores on current machine
Description
Get number of available cores on current machineUsage
availableCores(methods = getOption("availableCoresMethods", c("Slurm", "PBS",
"mc.cores", "system")))
Arguments
methods
A character vector specifying how to infer the number
of available cores (and in what order).
Value
- Return a positive integer equal or greater to one.
If multicore processing is not supported, then one is returned.
Details
The following methods for inferring the number of cores are supported:
"Slurm"
-
Query Simple Linux Utility for Resource Management (Slurm)
environment variableSLURM_CPUS_PER_TASK
.
This may or may not be set. It can be set when submitting a job,
e.g. `sbatch --cpus-per-task=2 hello.sh` or by adding
`#SBATCH --cpus-per-task=2` to the `hello.sh` script."PBS"
-
Query Torque/PBS environment variablePBS_NUM_PPN
.
Depending on PBS system configuration, thisresourceparameter
may or may not default to one. It can be specified when submitting
a job as in, for instance,qsub -l nodes=4:ppn=2
, which
requests four nodes each with two cores."mc.cores"
-
Query optionmc.cores
, cf.mclapply()
."system"
-
QuerydetectCores()
.