[R-sig-hpc] snow question

Li, Xiaochun xiaochun at iupui.edu
Wed Oct 28 04:34:04 CET 2009


I encountered this strange problem:

xiaochun at Quarry: ~/OMOP/ParEg005> orterun -n 1 -H b005,b006 r -lsnow,Rmpi rmpi_snow.R
        4 slaves are spawned successfully. 0 failed.
     nodename
[1,] "b006"  
[2,] "b005"  
[3,] "b006"  
[4,] "b005"  
Error in integSnow(c1, func, xint, yint, n) : object 'c1' not found

Attached is my code 'rmpi_snow.R"- taken from http://www.jstatsoft.org/v31/i01

Thank you for your help.

Xiaochun

'rmpi_snow.R':

cl <- makeCluster(4, "MPI")
res <- clusterCall(cl,  function() Sys.info()["nodename"])
print(do.call(rbind,res))
###################################################
### chunk number 1: Define problem function
###################################################
xint <- c(-1, 2)
yint <- c(-1, 2)
func <- function(x, y) x^3-3*x + y^3-3*y

###################################################
### chunk number 10: Define function to solve problem in parallel with snow
###################################################
integSnow <- function(cluster, func, xint, yint, n)
{
        nslaves <- length(cluster)
        erg <- clusterApplyLB(cluster, 1:nslaves,
                        slavefunc, nslaves, xint, yint, n, func)
        return( sum(unlist(erg)) )
}

###################################################
### chunk number 12:
###################################################
n <- 10000

###################################################
### chunk number 16: Calculate parallel results with snow eval=FALSE
###################################################
erg <- integSnow(c1, func, xint, yint, n)



More information about the R-sig-hpc mailing list