Hope
Hope

Reputation: 143

Use save() within sfClusterCall()

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

Upvotes: 1

Views: 158

Answers (0)

Related Questions