[R] Parallel Processing

Glenn Schultz glennmschultz at me.com
Fri Aug 14 03:39:27 CEST 2015


Helllo All,

Need some help understanding parallel processing.  I set-up DoParallel and worked perfectly.  I tried to set-up using parallel package following the book Parallel R but I get the following error:
Error in checkForRemoteErrors(val) : 
  4 nodes produced errors; first error: 'what' must be a character string or a function 

I have read some posts on the internet suggesting the issue may be related to S4 class and I have tried parse() to no avail.  I have read Snow and Parallel documentation but I am not getting the issue.

Glenn  

library(parallel)
library(foreach)
library(doParallel)

From Parallel R and Internet set up the following
============ DoParallel 4 seconds (perfect) took about 10 mins to set-up ==============
ptm <- proc.time()
Cluster <- makeCluster(detectCores())
registerDoParallel(Cluster)
clusterSetRNGStream(cl = Cluster, set.seed(100))
OAS <- foreach(i = 1:4, .packages = c("BondLab"), .combine = cbind) %dopar% 
  Mortgage.OAS(bond.id = "bondlabMBS4", trade.date = "01-10-2013", settlement.date = "01-13-2013",
  original.bal = 100000, price = 105.75, sigma = .23/sqrt(240), paths = 50)@OAS
mean(OAS)
proc.time() - ptm
hist(OAS * 100, breaks = 20)
stopCluster(Cluster)

============== followed the book example fails with the following message:
Error in checkForRemoteErrors(val) : 
  4 nodes produced errors; first error: 'what' must be a character string or a function ============

ptm <- proc.time()
RNGkind("L'Ecuyer-CMRG")
cl <- makeCluster(detectCores())
clusterSetRNGStream(cl, set.seed(100))
clusterEvalQ(cl, library(BondLab))
OAS <- clusterApply(cl = cl, 1:4, Mortgage.OAS(bond.id = "bondlabMBS4", 
          trade.date = "01-10-2013", settlement.date = "01-13-2013",
          original.bal = 100000, price = 105.75, sigma = .23/sqrt(240), paths = 50)@OAS) 
proc.time() - ptm
mean(OAS)
hist(OAS * 100, breaks = 20)
stopCluster(cl)



More information about the R-help mailing list