Permalink
Browse files

old createCluster file added

  • Loading branch information...
1 parent 71bcf9c commit 3f3a1d63d385e2570c05ed9ffbbb8393232993d0 @cboettig committed Apr 11, 2013
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,15 @@
+
+# Functions
+createCluster = function(noCores, logfile = "/dev/null", export = NULL, lib = NULL) {
+ require(doSNOW)
+ cl <- makeCluster(noCores, type = "SOCK", outfile = logfile)
+ if(!is.null(export)) clusterExport(cl, export)
+ if(!is.null(lib)) {
+ l_ply(lib, function(dum) {
+ clusterExport(cl, "dum", envir = environment())
+ clusterEvalQ(cl, library(dum, character.only = TRUE))
+ })
+ }
+ registerDoSNOW(cl)
+ return(cl)
+}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3f3a1d6

Please sign in to comment.