Displaying 20 results from an estimated 68 matches for "stopcluster".
2012 Aug 08
1
random number generator with SNOW/ Parallel/ foreach
...e.seed <- substring(Sys.time(), 21, 26))
a <- rnorm(5,0,1)
return(a)
}
maxkk <- 5
cl <- makeCluster(5, type = "SOCK")
registerDoSNOW(cl)
results=foreach (i = 1:maxkk, .combine = 'rbind') %dopar% testfun()
results
stopCluster(cl)
#################
2. Suppose I want to use *snow*, according to some reference, I need to use
*rsprng* as a generator. Does this generator relay on seed as well? But it
seems to me that if I do not use rsprng, it is also fine.
## code without rsprng ##
testfun <- function(){
a <- rnor...
2008 Mar 27
1
snow, stopping cluster
Hello,
is there any function in the package snow to check for a really running
cluster?
The function checkCluster only checks the variable cl. And the variable
is still available after stopping the cluster!
( a simple solution would be deleting the cluster variable cl in the
function stopCluster)
> library(snow)
> cl <- makeCluster(5)
5 slaves are spawned successfully. 0 failed.
> clusterApply(cl, 1:2, get("+"), 3)
[[1]]
[1] 4
[[2]]
[1] 5
> stopCluster(c1)
[1] 1
> clusterApply(cl, 1:2, get("+"), 3)
Fehler in mpi.probe(source, tag, comm,...
2011 Feb 25
1
Question about foreach (with doSNOW), is that a bug?
...le, subset=(age <= 28)))
}
# Do the same thing twice with foreach and doSNOW
# it fails!! the error msg was (could not find function "coeftest")
cl<-makeCluster(2)
registerDoSNOW(cl)
foreach(i=1:2) %dopar% {
coeftest(lm(length ~ age, data=Mandible, subset=(age <= 28)))
}
stopCluster(cl)
# However if i put require(lmtest) inside the foreach loop, it works again!
cl<-makeCluster(2)
registerDoSNOW(cl)
foreach(i=1:2) %dopar% {
require(lmtest)
coeftest(lm(length ~ age, data=Mandible, subset=(age <= 28)))
}
stopCluster(cl)
Regards,
Julian
[[alternative H...
2013 Jan 23
3
How to construct a valid seed for l'Ecuyer's method with given .Random.seed?
...information in .Random.seed?
Thanks & Cheers,
Marius
Here is the minimal example:
require(doSNOW)
require(foreach)
doForeach <- function(n, seed=1, type="MPI")
{
## create cluster object
cl <- snow::makeCluster(parallel::detectCores(), type=type)
on.exit(snow::stopCluster(cl)) ## shut down cluster and terminate execution environment
registerDoSNOW(cl) ## register the cluster object with foreach
## seed
if(seed=="L'Ecuyer-CMRG") {
if(!exists(".Random.seed")) stop(".Random.seed does not exist - in l'Ecuyer setting&...
2006 Apr 04
1
Mpirun with R CMD scripts
...machine
"cheaha.ac.uab.edu" "x86_64"
[[2]]
nodename machine
"compute-0-12.local" "x86_64"
[[3]]
nodename machine
"compute-0-13.local" "x86_64"
> stopCluster(c1)
[1] 1
> q()
--------------------------------------
But on running the same script with mpirun i get the following error.
*****************************************************************8
[srividya at cheaha ~]$ mpirun -np 3 R -slave R CMD BATCH TestSnow.R
/home/srividya/R/library/snow/RMPI...
2010 Dec 17
1
[R-sig-hpc] Error in makeMPIcluster(spec, ...): how to get a minimal example for parallel computing with doSNOW to run?
...s foreach
> library(Rmpi) # for default in makeCluster()
> cl<- makeCluster(3) # create cluster object with the given number of slaves
> registerDoSNOW(cl) # register the cluster object with foreach
> x<- foreach(i = 1:3) %dopar% { # simple test
> sqrt(i)
> }
> x
> stopCluster(cl) # properly shut down the cluster
>
> ## ==== minimal example ====
>
> ## ==== output ====
>
> Sender: LSF System<lsfadmin at a6218>
> Subject: Job 921476:<mpirun R --no-save -q -f doSNOW_minimal.R> Done
>
> Job<mpirun R --no-save -q -f doSNOW_minimal.R...
2018 Mar 14
2
clusterApply arguments
...Apply(clu, x = 1:2, fun = fun, x1 = 1) ## OK
parLapply(cl = clu, X = 1:2, fun = fun, x1 = 1) #OK
fun <- function(b, c) (b + c)
clusterApply(clu, x = 1:2, fun = fun, c = 1) ## Error
clusterApply(cl = clu, x = 1:2, fun = fun, c = 1) ## OK
parLapply(cl = clu, X = 1:2, fun = fun, c = 1) ## Error
stopCluster(clu)
I used "R version 3.4.3 Patched (2018-01-07 r74099".
Best regards,
Florian
2009 Nov 17
2
SVM Param Tuning with using SNOW package
...sqrt(sum((results.lin-hogTest$Y)^2)/length(hogTest$Y))
return(e.test.lin)
}
}
cl<- makeCluster(10, type="SOCK" )
clusterEvalQ(cl,library(e1071))
clusterExport(cl,c("data.X","data.Y","NR","cost1"))
RMSEP<-clusterApplyLB(cl,cost1,sv.lin)
stopCluster(cl)
--
View this message in context: http://old.nabble.com/SVM-Param-Tuning-with-using-SNOW-package-tp26399401p26399401.html
Sent from the R help mailing list archive at Nabble.com.
2013 Dec 24
2
Parallel computing: how to transmit multiple parameters to a function in parLapply?
...access y in the global scope.
return(z)
}
np <- detectCores(logical = FALSE) # Two cores of my laptop
x <- seq(1, 10, by = 1)
y <- 0.5 # Y may be an array in reality.
cl <- makeCluster(np) # initiate the cluster
r <- parLapply(cl, x, f) # apply f to x for parallel computing
stopCluster(cl)
The r was a list with 10 empty elements which means f failed to access y.
Then I tested f without parallel computing:
z <- f(x)
print(z)
[1] 2.5 4.5 6.5 8.5 10.5 12.5 14.5 16.5 18.5 20.5
The results indicates that we can access y using .GlobalEnv$y in a function
without parLapply.
Th...
2010 May 12
1
snow makeCluster (makeSOCKcluster) not working in R-2.11
Hello,
I was using snow to parallel-process some code in R-2.10 (32-bit
windows. ). The code is as follows:
require(foreach)
require(doSNOW)
cl <- makeCluster(6, type='SOCK')
registerDoSNOW(cl)
bl2 <- foreach(i=icount(length(unqmrno))) %dopar% {
(some code here)
}
stopCluster(cl)
When I run the same code in Windows R-2.11 (either 32-bit or 64-bit), R
hangs at cl<-makeCluster(6, type='SOCK') and no R processes are spawned.
I was wondering if others have encountered this problem, and any
suggestions on solving this would be greatly appreciated.
--
Abhijit...
2011 Oct 13
1
Package snow: is there any way to check if a cluster is "acticve"
.....$ con :Classes 'sockconn', 'connection' atomic [1:1] 3
.. .. ..- attr(*, "conn_id")=<externalptr>
..$ host: chr "localhost"
..$ rank: int 1
..- attr(*, "class")= chr "SOCKnode"
$ :List of 3
....
Then I stop it with
> stopCluster(.PBcluster)
> .PBcluster
[[1]]
$con
Error in summary.connection(x) : invalid connection
> str(.PBcluster)
List of 4
$ :List of 3
..$ con :Classes 'sockconn', 'connection' atomic [1:1] 3
.. .. ..- attr(*, "conn_id")=<externalptr>
..$ host: chr "lo...
2012 Mar 17
1
parApply vs parCapply
...l, x, 2, function(y) y)
[,1] [,2]
[1,] -0.9649685 0.91339851
[2,] -1.4313140 0.13457671
[3,] 1.0499248 1.58967879
[4,] -1.8974411 0.03639876
parCapply(cl, x, function(y) y)
[1] -0.96496852 -1.43131396 1.04992479 -1.89744113 0.91339851 0.13457671
[7] 1.58967879 0.03639876
stopCluster(cl)
> sessionInfo()
R version 2.15.0 beta (2012-03-15 r58760)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base...
2012 Dec 21
1
Parallel code using parLapply
...))
c <- as.data.frame(replicate(1000, rnorm(20)))
d <- as.data.frame(replicate(1000, rnorm(20)))
abcd <- list(a, b, c, d)
cl <- makeCluster(4)
results <- parLapply(cl,
X = abcd,
FUN = function(i) {
clhs(x = i, size = round(nrow(i) / 5), iter = 2000, simple = FALSE)
},
)
stopCluster(cl)
******************************************
Before running the last line, R is throwing an error: "Error in length(x) : 'x' is missing". Any ideas what I am doing wrong and how to improve?
Many thanks!
Best, Chega
[[alternative HTML version deleted]]
2013 Apr 18
1
parSapply can't find function
...nction(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
------------------------------
FMB, Erasmus MC
k.zhong@erasmusmc.nl
kindlychung@gmail.com
[[alternative HTML version delete...
2020 Oct 29
2
Something is wrong with the unserialize function
...;wrb")
writeBin(rep(0.0,10),con)
close(con)
library(simplemmap)
library(parallel)
cl <- makeCluster(1)
x <- mmap(filePath, "double")
## Turn gctorture on
clusterEvalQ(cl, gctorture())
clusterExport(cl, "x")
## x is an 0-length vector on the worker
clusterEvalQ(cl, x)
stopCluster(cl)
```
you can find more info on the problem if you manually build a connection
between two R processes and export the ALTREP object. See output below
```
> con <- socketConnection(port = 1234,server = FALSE)
> gctorture()
> x <- unserialize(con)
Warning message:
In unserialize(con...
2015 Feb 09
2
R CMD check: Uses the superseded package: ‘doSNOW’
...registerDoSNOW(cl <- makeCluster(2, type = "SOCK"))
> ci(roc2, method="bootstrap", parallel=TRUE)
> \dontrun{ci(roc2, method="bootstrap", parallel=TRUE)}
> \dontshow{ci(roc2, method="bootstrap", parallel=TRUE, boot.n=20)}
> stopCluster(cl)
> }
> #endif
> #ifdef unix
> if (require(doMC)) {
> registerDoMC(2)
> \dontrun{ci(roc2, method="bootstrap", parallel=TRUE)}
> \dontshow{ci(roc2, method="bootstrap", parallel=TRUE, boot.n=20)}
> }
> #endif
The "superseded" par...
2011 Mar 13
1
R hangs when connected via VPN [incl. minimal example]
...us
library(doSNOW)
library(Rmpi)
library(rlecuyer)
library(foreach)
cl <- makeCluster(mpi.universe.size(), type ="MPI")
tmp <- clusterSetupRNG(cl, seed=rep(1,6))
registerDoSNOW(cl)
counter <- 0
res <- foreach(k = 1:1000) %do% {
counter <- counter + 1
}
tmp <- stopCluster(cl)
unlist(res)
2006 Apr 20
1
Parallel computing with the snow package: external file I/O possible?
...<- function(base.dir) {
this.host <- as.character(system("hostname", intern=T))
this.rnd <- sample(1:1e6, 1)
test.file <- paste(sep="", base.dir, this.host, "_", this.rnd)
file.create(test.file)
} # end my.test()
clusterCall(cl, my.test, base.dir)
stopCluster(cl)
# End code
For example, the files "moab_65835" and "escalante_65835" are created.
Regards,
Scott Waichler
Pacific Northwest National Laboratory
scott.waichler at pnl.gov
2013 Feb 07
1
R intermittently crashes across cluster
...ery time. The following code segment shows what I am trying to do:
for (j in loopstart:loopend)
{
call.m=list(
step1=T,
dat=x.m[,c(1:7, j)] # x.m is data from a csv file
read into a table
)
clusterApplyLB(cluster,c(10:100),test.each.term,call=call.m)
}
stopCluster(cluster)
The problem that I am having is that sometimes it will run for 50
iterations of this loop then crash. Sometimes 15 iterations,
sometimes 2. When the crash happens, I receive the following error
message every time:
Error in checkForRemoteErrors(val) :
one node produced an error: c...
2019 Jun 07
1
Parallel number stream: clusterSetRNGStream
...r 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
reproducible seeds.
>From Details
.... optionally setting the seed of the streams by set.seed(iseed)
(otherwise they are set from the current seed of the master process:
a...