从我的问题的性质可以看出,我是 r 编程的新手。我正在尝试利用 train 函数的并行计算能力。
library(parallel)
#detects number of cores available to use for parallel package
nCores <- detectCores(logical = FALSE)
cat(nCores, " cores detected.")
# detect threads with parallel()
nThreads<- detectCores(logical = TRUE)
cat(nThreads, " threads detected.")
# Create doSNOW compute cluster (try 64)
# One can increase up to 128 nodes
# Each node requires 44 Mbyte RAM under WINDOWS.
cluster <- makeCluster(128, type = "SOCK")
class(cluster);
我需要有人帮我解释这段代码。最初的第一个参数makeCluster()
had nthreads 但在运行之后
nCores <- detectCores(logical = FALSE)
我了解到我有 4 个线程可用。我根据指南中提供的消息更改了值。这能让我一次同时运行 128 次 train 函数迭代吗?如果是这样,首先获取我的计算机拥有的线程和内核数量有什么意义?