Linked Questions

Popular Questions

Use save() within sfClusterCall()

Asked by At

I want to run a parallelized simulation using snowfall. Trying to aquire data using return() causes the cluster to exceed memory limitations. Data is at some point not recorded anymore. So I want to use save() to write the data to a file after each replicate.

sfInit()

try<-function(x){

save(list=ls(),file=paste("myfilename_",x,".RData",sep=""))

}

sfClusterSetupRNG()

sfClusterCall(try,1:100)

sfStop()

The error I get is

Error in gzfile(file, "wb") : invalid 'description' argument

Calls: sfClusterCall -> do.call -> -> save -> gzfile

In addition: Warning message:

In if (!nzchar(file)) stop("'file' must be non-empty string") :

the condition has length > 1 and only the first element will be used

Related Questions