This is my code. The stuff inside the loop makes sense.
library(foreach)
library(doParallel)
cl <- makeCluster(7)
registerDoParallel(cl)
elasticitylist = foreach(i=1:nhousehold) %dopar% {
pricedraws = out$betadraw[i,12,]
elasticitydraws[,,i]= probarray[,,i] %*% diag(pricedraws)
elasticitydraws[,,i] = elasticitydraws[,,i] * as.vector(medianpricemat)
}
I keep getting this error:
Error in serialize(data, node$con) : error writing to connection
I know I have enough cores (there are 20). Can anyone help with this? It seems the answer is nowhere to be found in docs!
When I run ps -ef| grep user
on my unix server, I get:
/apps/R.3.1.2/lib64/R/bin/exec/R --slave --no-restore -e parallel:::.slaveRSOCK() --args MASTER=localhost PORT=11025 OUT=/dev/null TIMEOUT=2592000 METHODS=TRUE XDR=TRUE
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…