[Vegan-commits] r2046 - in pkg/vegan: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 16 12:02:52 CET 2012


Author: jarioksa
Date: 2012-01-16 12:02:52 +0100 (Mon, 16 Jan 2012)
New Revision: 2046

Modified:
   pkg/vegan/R/oecosimu.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/oecosimu.Rd
Log:
honour setDefaultCluster() in systems where available

Modified: pkg/vegan/R/oecosimu.R
===================================================================
--- pkg/vegan/R/oecosimu.R	2012-01-15 15:33:45 UTC (rev 2045)
+++ pkg/vegan/R/oecosimu.R	2012-01-16 11:02:52 UTC (rev 2046)
@@ -2,7 +2,7 @@
     function(comm, nestfun, method, nsimul=99,
              burnin=0, thin=1, statistic = "statistic",
              alternative = c("two.sided", "less", "greater"),
-             parallel = getOption("mc.cores", 1L), ...)
+             parallel = getOption("mc.cores"), ...)
 {
     alternative <- match.arg(alternative)
     nestfun <- match.fun(nestfun)
@@ -58,7 +58,12 @@
     ## Go to parallel processing if 'parallel > 1' or 'parallel' could
     ## be a pre-defined socket cluster or 'parallel = NULL' in which
     ## case it could be setDefaultCluster (or a user error)
-    hasClus <- inherits(parallel, "cluster") || is.null(parallel)
+    if (is.null(parallel) && getRversion() >= "2.15.0")
+        parallel <- get("default", envir = parallel:::.reg)
+    ## still NULL? was not a defaultCluster, so make to non-parallel
+    if (is.null(parallel) || getRversion() < "2.14.0")
+        parallel <- 1
+    hasClus <- inherits(parallel, "cluster")
     if ((hasClus || parallel > 1)  && require(parallel)) {
         if(.Platform$OS.type == "unix" && !hasClus) {
             tmp <- mclapply(1:nsimul,

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2012-01-15 15:33:45 UTC (rev 2045)
+++ pkg/vegan/inst/ChangeLog	2012-01-16 11:02:52 UTC (rev 2046)
@@ -13,6 +13,14 @@
 	_R_CHECK_FORCE_SUGGESTS_=FALSE (see, e.g., discussion
 	https://stat.ethz.ch/pipermail/r-devel/2011-December/062827.html).
 
+	* oecosimu: new experimental parallel block which honours
+	setDefaultCluster() in R-devel (becoming R 2.15.0) and
+	automatically uses parallel processing with socket clusters if
+	setDefaultCluster was defined. Tested in R (unstable) (2012-01-16
+	r58122) with full features, and in R version 2.13.1 (2011-07-08)
+	without parallel processing, but not yet in R 2.14.1 with parallel
+	processing but without setDefaultCluster().
+
 	* anova.ccabymargin failed if none of the terms was analysed (all
 	were aliased) and no permutations were performed.  This would
 	happen with, e.g.,

Modified: pkg/vegan/man/oecosimu.Rd
===================================================================
--- pkg/vegan/man/oecosimu.Rd	2012-01-15 15:33:45 UTC (rev 2045)
+++ pkg/vegan/man/oecosimu.Rd	2012-01-16 11:02:52 UTC (rev 2046)
@@ -29,7 +29,7 @@
 \usage{
 oecosimu(comm, nestfun, method, nsimul = 99, burnin = 0, thin = 1,
    statistic = "statistic", alternative = c("two.sided", "less", "greater"), 
-   parallel = getOption("mc.cores", 1L), ...)
+   parallel = getOption("mc.cores"), ...)
 \method{as.ts}{oecosimu}(x, ...)
 \method{as.mcmc}{oecosimu}(x)
 \method{density}{oecosimu}(x, ...)



More information about the Vegan-commits mailing list