doSMP pulled

[This article was first published on CYBAEA Data, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 their blog: CYBAEA Data.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)