Created
July 1, 2011 17:22
-
-
Save cboettig/1059002 to your computer and use it in GitHub Desktop.
Amazon cloud via segue
This file contains 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
#segue_test.R | |
on.exit(stopCluster(myCluster)) | |
library(segue) | |
setCredentials(getOption("amazon_key"), getOption("amazon_secret")) | |
# Jeffery Breen's example, adapted with "custom function" works fine | |
my_fun <- mean # a custom definition | |
myList <- NULL | |
set.seed(1) | |
for(i in 1:10){ | |
a <- c(rnorm(999), NA) | |
myList[[i]] <- a | |
} | |
outputLocal <- lapply(myList, mean, na.rm=T) | |
myCluster <- createCluster(numInstances=2) | |
out <- emrlapply(myCluster, myList, my_fun, na.rm=T) | |
## fails on a CRAN library | |
require(sde) | |
# locally this works | |
x <- lapply(1:2, function(i) sde.sim(model="CIR", theta=c(6,2,1)) ) | |
# map reduce version fails | |
x <- emrlapply(1:2, function(i) sde.sim(model="CIR", theta=c(6,2,1)) ) | |
## fails to run on installed library | |
require(warningsignals) | |
pars <- c(Ro=5.0, m= -.04999, theta=500, sigma=5) | |
const_pars <- c(Ro=5.0, theta=500, sigma=5) | |
## Some initial data: Simulate some sample data under slow linear change | |
deteriorating <- lapply(1:2, function(i) simulateGauss(timedep_LSN, pars, N=100, T=100, Xo=500)) | |
deteriorating <- emrlapply(1:2, function(i) simulateGauss(timedep_LSN, pars, N=100, T=100, Xo=500)) | |
stopCluster(myCluster) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment