search for: defaultcluster

Displaying 12 results from an estimated 12 matches for "defaultcluster".

2012 Aug 21
1
parLapply fails to detect default cluster?
invoking parLapply without a cluster fails to find a previously registered cluster > library(parallel) > setDefaultCluster(makePSOCKcluster(2)) > parLapply(X=1:2, fun=function(...) {}) Error in cut.default(i, breaks) : invalid number of intervals This is because in parLapply length(cl) is determined before defaultCluster(cl) is called. By inspection, this appears to be true of other high-level functions, but iro...
2018 Mar 15
2
clusterApply arguments
...nation. >From my point of view parLapply(cl = clu, X = 1:2, fun = fun, c = 1) shouldn't give an error. This could be easily avoided by using all the argument names in the custerApply call of parLapply which means changing, parLapply <- function(cl = NULL, X, fun, ...) { cl <- defaultCluster(cl) do.call(c, clusterApply(cl, x = splitList(X, length(cl)), fun = lapply, fun, ...), quote = TRUE) } to parLapply <- function (cl = NULL, X, fun, ...) { cl <- defaultCluster(cl) do.call(c, clusterApply(cl = cl, x = splitList(X, length(cl)), fun = la...
2018 Mar 15
1
clusterApply arguments
...:2, fun = fun, c = 1) >> shouldn't give an error. >> >> This could be easily avoided by using all the argument >> names in the custerApply call of parLapply which means changing, >> >> parLapply <- function(cl = NULL, X, fun, ...) { >> cl <- defaultCluster(cl) >> do.call(c, clusterApply(cl, x = splitList(X, length(cl)), >> fun = lapply, fun, ...), quote = TRUE) >> } >> >> to >> >> parLapply <- function (cl = NULL, X, fun, ...) { >> cl <- defaultCluster(cl) >> do....
2018 Mar 15
0
clusterApply arguments
...gt; parLapply(cl = clu, X = 1:2, fun = fun, c = 1) > shouldn't give an error. > > This could be easily avoided by using all the argument > names in the custerApply call of parLapply which means changing, > > parLapply <- function(cl = NULL, X, fun, ...) { > cl <- defaultCluster(cl) > do.call(c, clusterApply(cl, x = splitList(X, length(cl)), > fun = lapply, fun, ...), quote = TRUE) > } > > to > > parLapply <- function (cl = NULL, X, fun, ...) { > cl <- defaultCluster(cl) > do.call(c, clusterApply(cl = cl, x = splitL...
2018 Feb 12
2
[parallel] fixes load balancing of parLapplyLB
...ere are fewer chunks than workers, each worker will get **at most one chunk** and there is **no** load balancing. ## parLapplyLB This is how **parLapplyLB** splits the input list (with a bit of refactoring, for readability): ```r parLapplyLB <- function(cl = NULL, X, fun, ...) { cl <- defaultCluster(cl) chunks <- splitList(X, length(cl)) do.call(c, clusterApplyLB(cl, x = chunks, fun = lapply, fun, ...), quote = TRUE) } ``` For our examples, the chunks have these sizes: ```r > sapply(parallel:::splitList(1:100, 5), length) [1] 20 20 20 20 20 ``` There...
2018 Mar 14
2
clusterApply arguments
Hi! I recognized that the argument matching of clusterApply (and therefore parLapply) goes wrong when one of the arguments of the function is called "c". In this case, the argument "c" is used as cluster and the functions give the following error message "Error in checkCluster(cl) : not a valid cluster". Of course, "c" is for many reasons an unfortunate
2018 Feb 19
2
[parallel] fixes load balancing of parLapplyLB
...e is **no** load balancing. >> >> >> ## parLapplyLB >> >> This is how **parLapplyLB** splits the input list (with a bit of refactoring, for readability): >> >> ```r >> parLapplyLB <- function(cl = NULL, X, fun, ...) >> { >> cl <- defaultCluster(cl) >> >> chunks <- splitList(X, length(cl)) >> >> do.call(c, >> clusterApplyLB(cl, x = chunks, fun = lapply, fun, ...), >> quote = TRUE) >> } >> ``` >> >> For our examples, the chunks have these sizes: &...
2018 Feb 19
0
[parallel] fixes load balancing of parLapplyLB
...l get **at most one chunk** and there is **no** load balancing. > > > ## parLapplyLB > > This is how **parLapplyLB** splits the input list (with a bit of refactoring, for readability): > > ```r > parLapplyLB <- function(cl = NULL, X, fun, ...) > { > cl <- defaultCluster(cl) > > chunks <- splitList(X, length(cl)) > > do.call(c, > clusterApplyLB(cl, x = chunks, fun = lapply, fun, ...), > quote = TRUE) > } > ``` > > For our examples, the chunks have these sizes: > > ```r >> sapply(parall...
2018 Feb 26
2
[parallel] fixes load balancing of parLapplyLB
...;> ## parLapplyLB >>>> >>>> This is how **parLapplyLB** splits the input list (with a bit of >> refactoring, for readability): >>>> ```r >>>> parLapplyLB <- function(cl = NULL, X, fun, ...) >>>> { >>>> cl <- defaultCluster(cl) >>>> >>>> chunks <- splitList(X, length(cl)) >>>> >>>> do.call(c, >>>> clusterApplyLB(cl, x = chunks, fun = lapply, fun, ...), >>>> quote = TRUE) >>>> } >>>> ``...
2018 Feb 20
0
[parallel] fixes load balancing of parLapplyLB
...;>> >>> ## parLapplyLB >>> >>> This is how **parLapplyLB** splits the input list (with a bit of >refactoring, for readability): >>> >>> ```r >>> parLapplyLB <- function(cl = NULL, X, fun, ...) >>> { >>> cl <- defaultCluster(cl) >>> >>> chunks <- splitList(X, length(cl)) >>> >>> do.call(c, >>> clusterApplyLB(cl, x = chunks, fun = lapply, fun, ...), >>> quote = TRUE) >>> } >>> ``` >>> >>> For our...
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
2018 Mar 01
0
[parallel] fixes load balancing of parLapplyLB
...;>>> >>>>> This is how **parLapplyLB** splits the input list (with a bit of >>> refactoring, for readability): >>>>> ```r >>>>> parLapplyLB <- function(cl = NULL, X, fun, ...) >>>>> { >>>>> ???? cl <- defaultCluster(cl) >>>>> >>>>> ???? chunks <- splitList(X, length(cl)) >>>>> >>>>> ???? do.call(c, >>>>> ???????????? clusterApplyLB(cl, x = chunks, fun = lapply, fun, ...), >>>>> ???????????? quote = TRUE) >>>&g...