The created cluster has only one node.

makeClusterSequential()

Details

Expression and function calls are evaluated in a local environment, inheriting the global environment.

Requirements

This function is only defined for R (>= 4.4.0).

Examples

if (getRversion() >= "4.4.0") {
library(parallel)

cl <- makeClusterSequential()
print(cl)

y <- parLapply(cl, X = 1:3, fun = sqrt)
str(y)

pid <- Sys.getpid()
print(pid)
y <- clusterEvalQ(cl, Sys.getpid())
str(y)

abc <- 3.14
y <- clusterEvalQ(cl, { abc <- 42; abc })
str(y)
stopifnot(abc == 3.14)

}
#> A ‘sequential_cluster’ cluster with 1 node
#> List of 3
#>  $ : num 1
#>  $ : num 1.41
#>  $ : num 1.73
#> [1] 277552
#> List of 1
#>  $ : int 277552
#> List of 1
#>  $ : num 42