From schmidb at ibe.med.uni-muenchen.de  Mon Sep  3 08:45:45 2007
From: schmidb at ibe.med.uni-muenchen.de (Markus Schmidberger)
Date: Mon, 03 Sep 2007 08:45:45 +0200
Subject: [Rd] Snow on Windows Cluster
Message-ID: <46DBAD99.3010800@ibe.med.uni-muenchen.de>

Hello,

the package snow is not working on a windows cluster with MPICH2 and 
Rmpi. There is an error in makeCluster:

launch failed: CreateProcess(/usr/bin/env 
"RPROG="C:\Programme\R\R-2.5.1\bin\R" "OUT=/dev/null" "R_LIBS=" 
C:/Programme/R/R-2.5.1/library/snow/RMPInode.sh) on 'cl1' failed, error 
3 - Das System kann den angegbenen Pfad nicht finden.

I looked into makeMPIcluster. It could not work, mpi.comm.spawn gets the 
shell command for unix to start the slaves. A simple solution is to use 
the windows-code from mpi.spawn.rslaves, then it looks like this. And is 
working on our windows-cluster. (small failures on stopping cluster)

# Fro windows
if (.Platform$OS=="windows"){
    workdrive <- unlist(strsplit(getwd(),":"))[1]
    tmpdrive <- unlist(strsplit(tempdir(),":"))[1]
    worktmp <- as.logical(toupper(workdrive)==toupper(tmpdrive))
    tmpdir <- unlist(strsplit(tempdir(),"/Rtmp"))[1]
    localhost <- Sys.getenv("COMPUTERNAME")
    networkdrive <-.Call("RegQuery", 
as.integer(2),paste("NETWORK\\",workdrive,sep=""),
                       PACKAGE="Rmpi")
    remotepath <-networkdrive[which(networkdrive=="RemotePath")+1]
    mapdrive=TRUE
    mapdrive <- as.logical(mapdrive && !is.null(remotepath))
    Rscript=system.file("slaveload.R", package="snow")
    arg <- c(Rscript, R.home(), workdrive, getwd(),worktmp, tmpdir,
                   localhost, mapdrive, remotepath)
            
#Rscript,R_HOME,WDrive,WDir,WorkTmp,TmpDir,Master,MapDrive,RemotePath
    print("super")
    count<-mpi.comm.spawn(
        slave=system.file("Rslaves.bat", package="Rmpi"),
        slavearg=arg,
        nslaves=count)
} else{   # for unix
    count <- mpi.comm.spawn(slave = "/usr/bin/env",
                                slavearg = args,
                                nslaves = count,
                                intercomm = intercomm)
}

Doing some work, there should be a better and nicer solution with 
directly using mpi.spawn.Rslaves.

Best
Markus

-- 
Dipl.-Tech. Math. Markus Schmidberger

Ludwig-Maximilians-Universit?t M?nchen
IBE - Institut f?r medizinische Informationsverarbeitung,
Biometrie und Epidemiologie
Marchioninistr. 15, D-81377 Muenchen
URL: http://ibe.web.med.uni-muenchen.de 
Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de



[Rd] Snow on Windows Cluster
Markus Schmidberger