Description Usage Arguments Details Value Examples
First checks the environment variable NCPUS
. This will typically be set in PBS jobs to the number of cores assigned to the job.
Otherwise, it will use the number of CPUs with detectCores
. If that fails or returns more than 12 cores, it will go back to 1 (as this is indicative that the job is being run on a supercomputer but without the NCPUS properly set).
1 | guessCores(verbose = TRUE, max = NULL)
|
verbose |
show the number of cores that was guessed. |
max |
limit the number of cores. Ignored if |
This function is especially useful for use with makeCluster
.
a number of cores to use
1 2 3 4 5 6 | ncpus <- guessCores(max = 2)
# With the parallel package
library(parallel)
cl = makeCluster(ncpus)
parLapply(cl = cl, 1:ncpus, log)
stopCluster(cl)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.