Skip to content

Instantly share code, notes, and snippets.

@filipkral
Last active March 5, 2016 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipkral/e8e46a7f61c5140b229b to your computer and use it in GitHub Desktop.
Save filipkral/e8e46a7f61c5140b229b to your computer and use it in GitHub Desktop.
Trivial example for parallel coputation using R snowfall package
# A trivial example for parallel computation using R snowfall package
require(snowfall)
sfInit(paralell=TRUE, cpus=2)
fn <- function(x){
return(x*x)
}
d <- 1:1000
result <- sfLapply(d, fn)
unlist(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment