« R and Linear Algebra | Main | Because it's Friday: Math experts split the check »

August 30, 2013

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a010534b1db25970b019104fcbfaf970c

Listed below are links to weblogs that reference Tutorial: Parallel programming with foreach:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

*parallelization

@mike, thanks, corrected above

I found doSNOW very useful as a way to send multiple SQL queries with minor changes (date ranges, cohort definitions, etc) to a database simultaneously.

library(doSNOW)
cl <- makeCluster(c("localhost","localhost"), type = "SOCK")
registerDoSNOW(cl)

i = list(TYdates,LYdates)

result <- foreach(j = 1:2, .packages="RODBC")%dopar%{
ch=odbcConnect("data warehouse")
sqlQuery(ch, paste('Your SQL here', i[j]))
}

Instead of writing a script that runs everything in series.

The comments to this entry are closed.


R for the Enterprise

Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid

Search Revolutions Blog