Last active
March 5, 2019 22:57
-
-
Save benfasoli/626f499cccbe7a25a44b897ed07ead9c to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env Rscript | |
library(parallel) | |
fun <- function(x) { | |
x^2 | |
} | |
cl <- makeForkCluster(nnodes = 2, outfile = '') | |
out <- parSapply(cl, 1:2, fun) | |
stopCluster(cl) | |
str(out) | |
# num [1:2] 1 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment