Last active
March 5, 2016 12:09
-
-
Save filipkral/e8e46a7f61c5140b229b to your computer and use it in GitHub Desktop.
Trivial example for parallel coputation using R snowfall package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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