search for: registerdoparallel

Displaying 6 results from an estimated 6 matches for "registerdoparallel".

2017 Aug 13
2
Paralelizar el cálculo de distancias
...y B y quiero calcular la distancia euclídea de todas las filas de A sobre todas las filas de B. Para ello he hecho lo siguiente #cargo las librerias library(foreach) library(doParallel) #establezco el numero de clusters, en mi caso 4, ya que el procesador tiene 4 nucleos cl<-makeCluster(4) registerDoParallel(cl) #Creo los dataframes A<-as.data.frame(matrix(rnorm(50,10,2),ncol=5,nrow=10)) B<-as.data.frame(matrix(rnorm(50,10,2),ncol=5,nrow=10)) #calculo las distancias foreach(j in 1:nrow(B),.combine="cbind") %:% foreach(i in 1:nrow(A),.combine="c") %dopar% { sqrt(sum((A...
2018 Mar 09
2
Package gamlss used inside foreach() and %dopar% fails to find an object
...%do% is used. I have searched for similar issues, but haven't managed to figure it out. This is on Windows 10 platform. Thanks in advance, Nik # -------------------------------------------------------------- library('gamlss') library('foreach') library('doParallel') registerDoParallel(cores = 4) # Generate data set.seed(314) sample.size <- 30 input.processed.cut <- data.frame(TP = round(runif(sample.size) * 100), FP = round(runif(sample.size) * 100), x = runif(sample.size)) # Fit Beta-binomial model3 &lt...
2018 Mar 09
0
Package gamlss used inside foreach() and %dopar% fails to find an object
...s, but haven't managed to figure >it out. This is on Windows 10 platform. > >Thanks in advance, >Nik > ># -------------------------------------------------------------- > >library('gamlss') >library('foreach') >library('doParallel') > >registerDoParallel(cores = 4) ># Generate data >set.seed(314) >sample.size <- 30 >input.processed.cut <- data.frame(TP = round(runif(sample.size) * 100), > > FP = round(runif(sample.size) * 100), > x = runif(sample.size)) &gt...
2015 May 11
1
Foreach %dopar% operator incorrectly load balancing
...with this is that it doesn't actually seem to perform non-trivial tasks at all anymore. This is an example of testing code I've been using for testing the %dopar% loop. library(iterators) library(foreach) library(doParallel) library(Parallel) nCores <- 4 cl <- makeCluster(nCores) registerDoParallel(cl) trials = 100000 x <- iris[which(iris[,5] != "setosa"),c(1,5)] t2 <- system.time({ r2 <- foreach(icount(trials), .combine=cbind) %dopar% { ind <- sample(100,100,replace= TRUE) results1 <- glm(x[ind,2]~x[ind,1],family=binomial(logit)) coefficients(res...
2016 Apr 27
0
using foreach function with gtrendsR
I have this code which is working library("checkpoint") library("gtrendsR") library("doParallel") cl<-makeCluster(4) registerDoParallel(cl) gconnect(usr = "email at gmail.com", psw = "password", verbose = FALSE) names <- c("apple","shit", "android", "rocks") formula <- function(x){ x0 <- gtrends(x, res = "7d") x1 <- x0[3] x2 <- as.data.frame(x1) x...
2013 Apr 24
0
help with execution of 'embarrassingly parallel' problem using foreach, doParallel on a windows system
...an I tell whether multi-threading is occurring? Suggestions for another approach? Example: ############################################################################################### require(foreach) require(doParallel) require(compile) require(compiler) cl <- makeCluster(detectCores()-1) registerDoParallel(cl) # foreach(i=1:100) %dopar% sqrt(i) d <- sort(rep(letters[1:24], 5)) e <- rep(1:24, 5) rand.int <- rnorm(n=length(e),mean=e, sd=4) f <- 3+ (e*rand.int)^2 g <- sort(rep(1:6, 20)) one <- data.frame(d,e,f,g) names(one) <- c('block1', 'ind', 'res','...