View source: R/makeClusterMPI.R
| makeClusterMPI | R Documentation |
The makeClusterMPI() function creates an MPI cluster of R workers
for parallel processing. This function utilizes
makeCluster(..., type = "MPI") of the parallel package and
tweaks the cluster in an attempt to avoid
stopCluster() from hanging (1).
WARNING: This function is very much in a beta version and should
only be used if parallel::makeCluster(..., type = "MPI") fails.
makeClusterMPI(
workers,
...,
autoStop = FALSE,
verbose = isTRUE(getOption("parallelly.debug"))
)
workers |
The number workers (as a positive integer). |
autoStop |
If TRUE, the cluster will be automatically stopped
using |
verbose |
If TRUE, informative messages are outputted. |
... |
Optional arguments passed to
|
Creating MPI clusters requires that the Rmpi and snow packages are installed.
An object of class c("RichMPIcluster", "MPIcluster", "cluster") consisting
of a list of "MPInode" workers.
In R (>= 4.4.0), an alternatively to using
cl <- parallelly::makeClusterMPI(workers) is:
cl <- parallel::makeCluster(workers, type = parallelly::MPI)
R-sig-hpc thread Rmpi: mpi.close.Rslaves() 'hangs' on 2017-09-28.
makeClusterPSOCK() and parallel::makeCluster().
## Not run:
if (requireNamespace("Rmpi") && requireNamespace("snow")) {
cl <- makeClusterMPI(2, autoStop = TRUE)
print(cl)
y <- parLapply(cl, X = 1:3, fun = sqrt)
print(y)
rm(list = "cl")
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.