I'm trying to use snow in my dual-core (hopefully later this is going to
run in a cluster). So, at this moment I create a cluster using SOCK
connection (MPI in the future). However when I try to use
clusterApplyLB I got "Error in socketSelect(socklist) : not a socket
connection". Any ideas ? Do you know if that is going to be an isuue too
when I swith from SOCK to MPI ?

Sample code is attached.

Thanks.



# TODO: Add comment
# 
# Author: diego
###############################################################################


rm(list=ls())
library("snow")
t1<-Sys.time()



rates<-c(0.5,0.5,0.7)
initialState<-c(0,0,0,0,0)
AllEvents<-c(1,1,1,1,2,2,2,3,1,2)
AllLocations<-c(1,2,3,4,1,4,2,1,5,4)
AllTimes<-1:10
AllConfigurations<-rbind(
                c(0,0,0,0,0),
                c(1,0,0,0,0),
                c(1,1,0,0,0),
                c(1,1,1,0,0),
                c(1,1,1,1,0),
                c(2,1,1,1,0),
                c(2,1,1,2,0),
                c(2,2,1,2,0),
                c(0,2,1,2,0),
                c(0,2,1,2,1),
                c(0,2,1,0,1)
                )

nevents<-length(AllEvents)

clusterSize<-2
cl<-makeCluster(clusterSize,type="SOCK")

arguments<-vector("list",nevents)

completedTimes<-c(0,AllTimes)
for(i in 1:nevents){
        element<-c(AllConfigurations[i,],
                                rates,
                                completedTimes[i],
                                AllEvents[i],
                                AllLocations[i],
                                AllTimes[i])
        arguments[[i]]<-element
}

source("GetLogLikelihood.R")
parallelOutputs<-clusterApplyLB(cl,arguments,GetLogLikelihood)  # This give me 
error
#parallelOutputs<-clusterApply(cl,arguments,GetLogLikelihood) # This Work OK

print(sum(unlist(parallelOutputs)))

stopCluster(cl)
t2<-Sys.time()
print(t2-t1)
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to