[R] MC_CORES and mc.cores for parallel package
Charles C. Berry
ccberry at ucsd.edu
Wed Dec 7 20:04:07 CET 2016
On Wed, 7 Dec 2016, Marc Girondot via R-help wrote:
> Hi,
>
> From the documentation of ?options
>
> Options set in package parallel
> These will be set when package parallel (or its namespace) is loaded if not
> already set.
>
> mc.cores:
> a integer giving the maximum allowed number of additional R processes allowed
> to be run in parallel to the current R process. Defaults to the setting of
> the environment variable MC_CORES if set. Most applications which use this
> assume a limit of 2 if it is unset.
>
As advertised.
- Start R with no MC_CORES specified:
- check environment var
- set environment var
- check options
- THEN load parallel
- check option again
Sys.getenv("MC_CORES")
[1] ""
> Sys.setenv("MC_CORES"=3L)
> options("mc.cores")
$mc.cores
NULL
> library(parallel)
> options("mc.cores")
$mc.cores
[1] 3
---
I think you confused things by loading parallel *before* setting the
environment var.
HTH,
Chuck
More information about the R-help
mailing list