makeClusterSequential: Create a "parallel" cluster running sequentially in the...

View source: R/makeClusterSequential.R

makeClusterSequentialR Documentation

Create a "parallel" cluster running sequentially in the current session

Description

The created cluster has only one node.

Usage

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


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)




parallelly documentation built on Sept. 11, 2024, 7:56 p.m.