availableCores(constraints = NULL,
methods = getOption("future.availableCoresMethods", c("system",
"mc.cores+1", "_R_CHECK_LIMIT_CORES_", "Slurm", "PBS")), na.rm = TRUE,
default = c(current = 1L), which = c("min", "max", "all"))
constrains="multicore"
will force a
single core "min"
, the minimum value is returned.
If "max"
, the maximum value is returned (be careful!)
If "all"
, all values are returned.which="all"
, then more than one value may be returned.
Together with na.rm=FALSE
missing values may also be returned."system"
-
QuerydetectCores()
."mc.cores+1"
-
If available, returns the value of optionmc.cores
+ 1.
Note thatmc.cores
is defined as the number ofadditionalR processes that can be used in addition to the
main R process. This means that withmc.cores=0
all
calculations should be done in the main R process, i.e. we have
exactly one core available for our calculations.
Themc.cores
option defaults to environment variableMC_CORES
(and is set accordingly when themc.cores
option is used by for
instancemclapply()
."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."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.
For any other value of amethods
element, the R option with the
same name is queried. If that is not set, the system environment
variable is queried. If neither is set, a missing value is returned.