我在R中的循环中在一个parLapply中运行parallel,但是我得到了一个错误:
library(doSNOW)
library(foreach)
cl<-makeCluster(4) #change the 2 to your number of CPU cores
registerDoSNOW(cl)
foreach(1:2) %dopar% {
clusterExport(cl, "parLapply")
parLapply(cl, 1:2,function(exponent)2^exponent)
}
在启动此代码时,我得到了以下错误:
&
我正在使用R中的snow包在具有多台机器(3)的SOCK集群上执行一个函数。我尝试用parLapply和clusterApply来运行代码。
在worker级别出现错误的情况下,worker节点的结果不会正确返回给master,这使得调试变得非常困难。我目前正在使用futile.logger独立地记录工作节点的每个心跳。看起来结果似乎是经过适当计算的。但是,当我试图在主节点上打印结果时(在收到工作节点的输出之后),我得到了一个错误,显示为Error in checkForRemoteErrors(val): 8 nodes produced errors; first error: missi
这是我很难理解的:
cl = makeCluster(rep("localhost", 8), "SOCK")
# This will not work, error: dat not found in the nodes
pmult = function(cl, a, x)
{
mult = function(s) s*x
parLapply(cl, a, mult)
}
scalars = 1:4
dat = rnorm(4)
pmult(cl, scalars, dat)
# This will work
pmult = functio
我正试图使用parLapply在我的机器的4个核心上并行化一些功能。我的函数定义了两个嵌入式循环,用于填充预定义矩阵M的一些空列。然而,当我运行下面的代码时,会得到以下错误
2 nodes produced errors; first error: incorrect number of dimensions
代码:
require("parallel")
TheData<-list(E,T) # list of 2 matrices of different dimensions, T is longer and wider than E
myfunc
在R中使用tm包和并行计算时,我有一个问题,我不确定我是在做一些愚蠢的事情,还是它是一个bug。
我创建了一个可复制的小例子:
# Load the libraries
library(tm)
library(snow)
# Create a Document Term Matrix
test_sentence = c("this is a test", "this is another test")
test_corpus = VCorpus(VectorSource(test_sentence))
test_TM = DocumentTermMatrix(
我试图用hargreaves方法计算package SPEI.This中的蒸发,包括使用最低温度(TMIN)和最高温度(TMAX)。考虑到Tmin和Tmax rasterstacks都有500,000 cells and 100 layers each,并行计算是我的最佳选择。Hargreaves function以Tmin、Tmax和latitude at each grid作为输入。以下是我第一次猜测如何做到这一点:
library(SPEI)
# go parallel
library(parallel)
clust <- makeCluster(detectCores())