search for: parsapply

Displaying 20 results from an estimated 21 matches for "parsapply".

Did you mean: parlapply
2013 Apr 18
1
parSapply can't find function
...-k):(n-1)]) } else {return(NA)} } predR = function(x, k) { pastList = lapply(1:length(x), function(n) pastK(n, x, k)) pred = sapply(pastList, function(v) mfv(v)[1]) ratio = sum(pred==x, na.rm=T)/(length(pred) - sum(is.na(pred))) } testK = function() { k = seq(3, 25, 2) r = parSapply(cl, k, function(i) predR(x, i)) # r = sapply(k, function(i) predR(x, i)) } r = testK() stopCluster(cl) Here is the error: Error in checkForRemoteErrors(val) : 8 nodes produced errors; first error: could not find function "predR" Best regards, Kaiyin ZHONG ----------------------...
2019 Jun 07
1
Parallel number stream: clusterSetRNGStream
Dear All, Is the following expected behaviour? set.seed(1) library(parallel) cl = makeCluster(5) clusterSetRNGStream(cl, iseed = NULL) parSapply(cl, 1:5, function(i) sample(1:10, 1)) # 7 4 2 10 10 clusterSetRNGStream(cl, iseed = NULL) # 7 4 2 10 10 parSapply(cl, 1:5, function(i) sample(1:10, 1)) stopCluster(cl) The documentation could be read either way, e.g. * iseed: An integer to be supplied to set.seed, or NULL not to set reproduc...
2014 Jul 02
1
parLapply on sqlQuery (from package RODBC)
...riverConnect #name : a char string sqlQuery(dbConn, paste("select id from table where name='", name, "'", sep="")) } mc<-detectCores() cl<-makeCluster(mc) clusterExport(cl, c("sqlQuery", "dbConn")) parSapply(cl, names, nameToID, dbConn=dbConn) #incorrect passing of nameToID's second argument ### As in the comment, this is not the correct way to assign the second argument to nameToID. I have also tried the following: parSapply(cl, names, function(x) nameToID(x, dbConn)) in place of the previo...
2007 Apr 24
2
Error in clusterApply(): recursive default argument reference
Hi, I want to compute a distribution of the intersection of a graph and 'randomized' graphs induced by the permutations of node labels (to preserve the graph topology). Since I ll have many permutations to perform, I was thinking of using the snow package and in particular "parSapply" to divide the work between my 4 CPUs. But I get the following error message : Error in clusterApply(cl, splitList(x, length(cl)), lapply, fun, ...) : recursive default argument reference What am i doing wrong ? Some details about my platform and R version : -----------------------...
2012 Oct 23
0
Typos/omissions/inconsistencies in man page for clusterApply
Hi, Here are the issues I found: Typos ----- (a) Found: It a parallel version of ?evalq?, "is" missing. (b) Found: 'parLapplyLB', 'parSapplyLB' are load-balancing versions, intended for use when applying ?FUN? to 'parLapplyLB' has no 'FUN' arg (more on this below). (c) Found: 'clusterApply' calls 'fun' on the first node with arguments 'seq[[1]]' and 'clusterApply' h...
2015 Nov 17
1
Exporting a method to a cluster object
...tion as a wrapper around this summary method and use lapply to apply the function to the list of matrices. This gives me the result I want: [,1] [,2] [,3] [,4] [,5] edges 94 94 94 94 94 dsp1 227 227 227 227 227 However, when I try to parallelize this by using parLapply or parSapply from the parallel package, the results look weird: [,1] [,2] [,3] [,4] [,5] Length "3" "3" "3" "3" "3" Class "formula" "formula" "formula" "formula" &quot...
2012 Aug 02
2
parallel SNOW slower than single core?
...uch slower than the regulat code. My laptop is X200s with dual core intel L9400 cpu. Should I make more clusters than 2? Or how to improve the performance? # install.packages("snow") library(snow) cl <- makeCluster(2) t1 <- proc.time() a <- c() for (i in 1:1000) { a[i] <- sum(parSapply(cl, 1:15, get("+"), 2)) } proc.time()-t1 t2 <- proc.time() a <- c() for (i in 1:1000) { a[i] <- sum(sapply(1:15, "+", 2)) } proc.time()-t2 [[alternative HTML version deleted]]
2004 Apr 08
2
socket clusters on snow dies easily
hello, I'm using R 1.8.1 with the lastest snow package on FreeBSD 4.9. However, when I try to using socket clusters, it's very unstable. Sometimes it dies half way when I run parSapply(), sometimes it dies when cluster connection is idle. I create a socket cluster by following cmd cl = makeCluster("foo", type = "SOCK", outfile="/tmp/rafanlog"); Then, I just idle in R, and tail -f outfile, I got following: [... some R msgs ...] Type ...
2018 Mar 04
3
Random Seed Location
...ple[, -3]) > > > If your computations involve the parallel package then set.seed(seed) may not produce repeatable results. E.g., > cl <- parallel::makeCluster(3) # Create cluster with 3 nodes on local host > set.seed(100); runif(2) [1] 0.3077661 0.2576725 > parallel::parSapply(cl, 101:103, function(i)runif(2, i, i+1)) [,1] [,2] [,3] [1,] 101.7779 102.5308 103.3459 [2,] 101.8128 102.6114 103.9102 > > set.seed(100); runif(2) [1] 0.3077661 0.2576725 > parallel::parSapply(cl, 101:103, function(i)runif(2, i, i+1)) [,1] [,2] [,3]...
2008 Dec 31
1
Problem with package SNOW on MacOS X 10.5.5
Hello All, I can run the "lower level" functions OK, but many of the higher level (eg. parSApply) functions are generating errors. When running the example (from the snow help docs) for parApply on MacOSX 10.5.5, I get the following error: cl <- makeSOCKcluster(c("localhost","localhost")) sum(parApply(cl, matrix(1:100,10), 1, sum)) Error in do.call("fun", l...
2018 Mar 04
0
Random Seed Location
...f your computations involve the parallel package then set.seed(seed) > may not produce repeatable results. E.g., > > > cl <- parallel::makeCluster(3) # Create cluster with 3 nodes on local > host > > set.seed(100); runif(2) > [1] 0.3077661 0.2576725 > > parallel::parSapply(cl, 101:103, function(i)runif(2, i, i+1)) > [,1] [,2] [,3] > [1,] 101.7779 102.5308 103.3459 > [2,] 101.8128 102.6114 103.9102 > > > > set.seed(100); runif(2) > [1] 0.3077661 0.2576725 > > parallel::parSapply(cl, 101:103, function(i)runif(2, i, i+1)) &g...
2018 Mar 04
2
Random Seed Location
...the parallel package then set.seed(seed) >> may not produce repeatable results. E.g., >> >> > cl <- parallel::makeCluster(3) # Create cluster with 3 nodes on local >> host >> > set.seed(100); runif(2) >> [1] 0.3077661 0.2576725 >> > parallel::parSapply(cl, 101:103, function(i)runif(2, i, i+1)) >> [,1] [,2] [,3] >> [1,] 101.7779 102.5308 103.3459 >> [2,] 101.8128 102.6114 103.9102 >> > >> > set.seed(100); runif(2) >> [1] 0.3077661 0.2576725 >> > parallel::parSapply(cl, 101:103, fun...
2018 Mar 04
0
Random Seed Location
...n set.seed(seed) >>> may not produce repeatable results. E.g., >>> >>>> cl <- parallel::makeCluster(3) # Create cluster with 3 nodes on local >>> host >>>> set.seed(100); runif(2) >>> [1] 0.3077661 0.2576725 >>>> parallel::parSapply(cl, 101:103, function(i)runif(2, i, i+1)) >>> [,1] [,2] [,3] >>> [1,] 101.7779 102.5308 103.3459 >>> [2,] 101.8128 102.6114 103.9102 >>>> >>>> set.seed(100); runif(2) >>> [1] 0.3077661 0.2576725 >>>> parallel::...
2011 Jul 02
5
%dopar% parallel processing experiment
dear R experts--- I am experimenting with multicore processing, so far with pretty disappointing results. Here is my simple example: A <- 100000 randvalues <- abs(rnorm(A)) minfn <- function( x, i ) { log(abs(x))+x^3+i/A+randvalues[i] } ?## an arbitrary function ARGV <- commandArgs(trailingOnly=TRUE) if (ARGV[1] == "do-onecore") { ?library(foreach) ?discard <-
2008 Mar 05
0
rsprng, snow, rmpi interactions
...reams are independent betweeen processes. Here's what I did, trying to stick within SNOW to avoid trouble (from memory): lamboot start up R library(snow) library(rsprng) library(rmpi) cl<-makeMPIcluster(11) clusterSetupSPRNG(cl, seed=123) clusterEvalQ(cl, source("mycode.R")) r<-parSapply(cl, seq(1000), function(i) doMyThing())) Any comments on that? For example, would sticking to Rmpi and using parSim make sense (I'm not using seq(1000) for anything but getting that many repetitions.)? Both rmpi and rsprng had a bunch of functions for setting of the parallel random number ge...
2009 May 09
1
Problem with package SNOW on MacOS X 10.5.5
...Lapply(1:10, exp) issues the same error you had posted, while subsequent rm("c") sfLapply(1:10, exp) runs fine. Rainer On Wed, 31 Dec 2008, Greg Riddick wrote: > Hello All, > > I can run the "lower level" functions OK, but many of the higher level > (eg. parSApply) functions are generating errors. > > When running the example (from the snow help docs) for parApply on > MacOSX 10.5.5, I get the > following error: > > > cl <- makeSOCKcluster(c("localhost","localhost")) > sum(parApply(cl, matrix(1:100,10),...
2013 Feb 26
1
parallel execution in R
Dear all, I have a piece of code that  I want to run in parallel (I am working in system of 16 cores) foreach (i=(seq(-93,-73,length.out=21))) %dopar%  {           threshold<-i            print(i)          do_analysis1(i,path)          do_analysis2(i,path)            do_something_else_analysis1(i,path)            something_else_now(i,path)  } as you can see I have already tried to make
2018 Feb 27
0
Random Seed Location
In case you don't get an answer from someone more knowledgeable: 1. I don't know. 2. But it is possible that other packages that are loaded after set.seed() fool with the RNG. 3. So I would call set.seed just before you invoke each random number generation to be safe. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking
2018 Mar 05
1
Random Seed Location
...t;>> cl <- parallel::makeCluster(3) # Create cluster with 3 nodes on local >>>> >>>> host >>>>> >>>>> set.seed(100); runif(2) >>>> >>>> [1] 0.3077661 0.2576725 >>>>> >>>>> parallel::parSapply(cl, 101:103, function(i)runif(2, i, i+1)) >>>> >>>> [,1] [,2] [,3] >>>> [1,] 101.7779 102.5308 103.3459 >>>> [2,] 101.8128 102.6114 103.9102 >>>>> >>>>> >>>>> set.seed(100); runif(2) >&g...
2018 Feb 26
3
Random Seed Location
Hi all, For some odd reason when running na?ve bayes, k-NN, etc., I get slightly different results (e.g., error rates, classification probabilities) from run to run even though I am using the same random seed. Nothing else (input-wise) is changing, but my results are somewhat different from run to run. The only randomness should be in the partitioning, and I have set the seed before this