doSMP pulled

March 1, 2012
By

(This article was first published on CYBAEA Data, and kindly contributed to R-bloggers)

They have finally pulled that buggy unreliable piece of code that was doSMP from the CRAN mirrors while (I hear) Revolutions are re-writing it. To use all your cores for analysis on the Windows platform, you can try doSNOW instead; my code is something like the fragment below. Neither option is as attractive as doMC on anything-but-Windows platforms, but sometimes you have to work with legacy systems.

library("foreach")
if (.Platform$OS.type != "windows" && require("multicore")) {
    registerDoMC()
} else if (FALSE &&                     # doSMP is buggy
           require("doSMP")) {
    w <- startWorkers()
    on.exit(stopWorkers(w), add = TRUE)
    registerDoSMP(w)
} else if (require("doSNOW")) {
    cl <- snow::makeCluster(4, type = "SOCK")
    on.exit(snow::stopCluster(cl), add = TRUE)
    registerDoSNOW(cl)
} else {
    registerDoSEQ()
}

Change the number 4 to the number of cores that you want to use on the machine. The explicit name space (snow::) is to avoid confusion if you load the "parallel" package or any of the other packages that also define a makeCluster() function.

I hope Revolutions does a good job on the new version: it needs some love.

To leave a comment for the author, please follow the link and comment on his blog: CYBAEA Data.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.