futureverse / futureverse/parallelly

WISH: Environment varaible to set the default cluster type for parallel:::getClusterOption("type")

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
R
Stars
140
Forks
9
PR merge metrics
No merged PRs in 30d

Description

(Adopted from an old 2017-09-05 note of mine)

When loaded, have the package set `parallel:::defaultClusterOptions$type` from (new) environment `R_PARALLELLY_CLUSTER_TYPE`, if available. This will then allow users to switch the default cluster type used by `parallel:::makeCluster()`.

```r
> parallel:::makeCluster
function (spec, type = getClusterOption("type"), ...)
{
switch(type, PSOCK = makePSOCKcluster(spec, ...), FORK = makeForkCluster(spec,
...), SOCK = snow::makeSOCKcluster(spec, ...), MPI = snow::makeMPIcluster(spec,
...), NWS = snow::makeNWScluster(spec, ...), stop("unknown cluster type"))
}

```

What about `snow::makeCluster()`, which works the same as `parallel::makeCluster()` but uses a different default? Contrary to `parallel`, the **parallelly** package does not depend/import **snow**, which means we cannot set ditto for **snow**. We could add a hook function that does it when / iff the **snow** package is loaded, but is that good?

# Source

* R-devel thread '[parallel-package] feature request: set default cluster type via environment variable', 2016-11-24, https://stat.ethz.ch/pipermail/r-devel/2016-November/073411.html

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.