[Vegan-commits] r2642 - in pkg/vegan: R inst vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Nov 3 15:34:21 CET 2013


Author: jarioksa
Date: 2013-11-03 15:34:20 +0100 (Sun, 03 Nov 2013)
New Revision: 2642

Modified:
   pkg/vegan/R/adonis.R
   pkg/vegan/R/anosim.R
   pkg/vegan/R/bioenv.default.R
   pkg/vegan/R/mantel.R
   pkg/vegan/R/mantel.partial.R
   pkg/vegan/R/metaMDSiter.R
   pkg/vegan/R/mrpp.R
   pkg/vegan/R/oecosimu.R
   pkg/vegan/R/permutest.cca.R
   pkg/vegan/R/simper.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/vignettes/decision-vegan.Rnw
Log:
do not use setDefaultCluster() clusters in parallel processing

Modified: pkg/vegan/R/adonis.R
===================================================================
--- pkg/vegan/R/adonis.R	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/R/adonis.R	2013-11-03 14:34:20 UTC (rev 2642)
@@ -107,8 +107,6 @@
     ## Apply permutations for each term
     ## This is the new f.test (2011-06-15) that uses fewer arguments
     ## Set first parallel processing for all terms
-    if (is.null(parallel) && getRversion() >= "2.15.0")
-        parallel <- get("default", envir = parallel:::.reg)
     if (is.null(parallel) || getRversion() < "2.14.0")
         parallel <- 1
     hasClus <- inherits(parallel, "cluster")

Modified: pkg/vegan/R/anosim.R
===================================================================
--- pkg/vegan/R/anosim.R	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/R/anosim.R	2013-11-03 14:34:20 UTC (rev 2642)
@@ -48,8 +48,6 @@
         permutations <- nrow(permat)
     }
     ## Parallel processing
-    if (is.null(parallel) && getRversion() >= "2.15.0")
-        parallel <- get("default", envir = parallel:::.reg)
     if (is.null(parallel) || getRversion() < "2.14.0")
         parallel <- 1
     hasClus <- inherits(parallel, "cluster")

Modified: pkg/vegan/R/bioenv.default.R
===================================================================
--- pkg/vegan/R/bioenv.default.R	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/R/bioenv.default.R	2013-11-03 14:34:20 UTC (rev 2642)
@@ -71,8 +71,6 @@
         comdis <- vegdist(comm, method = index)
     }
     ## Prepare for parallel processing
-    if (is.null(parallel) && getRversion() >= "2.15.0")
-        parallel <- get("default", envir = parallel:::.reg)
     if (is.null(parallel) || getRversion() < "2.14.0")
         parallel <- 1
     hasClus <- inherits(parallel, "cluster")

Modified: pkg/vegan/R/mantel.R
===================================================================
--- pkg/vegan/R/mantel.R	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/R/mantel.R	2013-11-03 14:34:20 UTC (rev 2642)
@@ -41,8 +41,6 @@
             drop(cor(permvec, ydis, method = method, use = use))
         }
         ## Parallel processing
-        if (is.null(parallel) && getRversion() >= "2.15.0")
-            parallel <- get("default", envir = parallel:::.reg)
         if (is.null(parallel) || getRversion() < "2.14.0")
             parallel <- 1
         hasClus <- inherits(parallel, "cluster")

Modified: pkg/vegan/R/mantel.partial.R
===================================================================
--- pkg/vegan/R/mantel.partial.R	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/R/mantel.partial.R	2013-11-03 14:34:20 UTC (rev 2642)
@@ -49,8 +49,6 @@
             part.cor(rxy, rxz, ryz)
         }
         ## parallel processing
-        if (is.null(parallel) && getRversion() >= "2.15.0")
-            parallel <- get("default", envir = parallel:::.reg)
         if (is.null(parallel) || getRversion() < "2.14.0")
             parallel <- 1
         hasClus <- inherits(parallel, "cluster")

Modified: pkg/vegan/R/metaMDSiter.R
===================================================================
--- pkg/vegan/R/metaMDSiter.R	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/R/metaMDSiter.R	2013-11-03 14:34:20 UTC (rev 2642)
@@ -73,8 +73,6 @@
         monostop(s0)
     tries <- 0
     ## Prepare for parallel processing
-    if (is.null(parallel) && getRversion() >= "2.15.0")
-        parallel <- get("default", envir = parallel:::.reg)
     if (is.null(parallel) || getRversion() < "2.14.0")
         parallel <- 1
     hasClus <- inherits(parallel, "cluster")

Modified: pkg/vegan/R/mrpp.R
===================================================================
--- pkg/vegan/R/mrpp.R	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/R/mrpp.R	2013-11-03 14:34:20 UTC (rev 2642)
@@ -50,8 +50,6 @@
                           ncol(perms), N))
     }
     ## Parallel processing
-    if (is.null(parallel) && getRversion() >= "2.15.0")
-        parallel <- get("default", envir = parallel:::.reg)
     if (is.null(parallel) || getRversion() < "2.14.0")
         parallel <- 1
     hasClus <- inherits(parallel, "cluster")

Modified: pkg/vegan/R/oecosimu.R
===================================================================
--- pkg/vegan/R/oecosimu.R	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/R/oecosimu.R	2013-11-03 14:34:20 UTC (rev 2642)
@@ -86,11 +86,7 @@
     ## start with empty simind
     simind <- NULL
     ## 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)
-    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
+    ## be a pre-defined socket cluster or 'parallel = NULL'.
     if (is.null(parallel) || getRversion() < "2.14.0")
         parallel <- 1
     hasClus <- inherits(parallel, "cluster")

Modified: pkg/vegan/R/permutest.cca.R
===================================================================
--- pkg/vegan/R/permutest.cca.R	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/R/permutest.cca.R	2013-11-03 14:34:20 UTC (rev 2642)
@@ -124,8 +124,6 @@
     }
     nperm <- nrow(permutations)
     ## Parallel processing (similar as in oecosimu)
-    if (is.null(parallel) && getRversion() >= "2.15.0")
-        parallel <- get("default", envir = parallel:::.reg)
     if (is.null(parallel) || getRversion() < "2.14.0")
         parallel <- 1
     hasClus <- inherits(parallel, "cluster")

Modified: pkg/vegan/R/simper.R
===================================================================
--- pkg/vegan/R/simper.R	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/R/simper.R	2013-11-03 14:34:20 UTC (rev 2642)
@@ -38,8 +38,6 @@
     if (nperm > 0)
         perm.contr <- matrix(nrow=P, ncol=nperm)
     ## Parallel processing ?
-    if (is.null(parallel) && getRversion() >= "2.15.0")
-        parallel <- get("default", envir = parallel:::.reg)
     if (is.null(parallel) || getRversion() < "2.14.0")
         parallel <- 1
     hasClus <- inherits(parallel, "cluster")

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/inst/ChangeLog	2013-11-03 14:34:20 UTC (rev 2642)
@@ -25,6 +25,11 @@
 	(testing theory requires nesting, but this is commonly violated by
 	users: here nesting is necessary). 
 
+	* parellel: default cluster defined by setDefaultCluster() is no
+	longer used in functions with parallel processing. Using default
+	cluster would need querying an unexported environment
+	parellel:::.reg, and this gives a NOTE in R CMD check.
+
 	* specaccum, renyiaccum, tsallisaccum: gained argument to select a
 	'subset' of sites (looks like my student would need them).
 	

Modified: pkg/vegan/vignettes/decision-vegan.Rnw
===================================================================
--- pkg/vegan/vignettes/decision-vegan.Rnw	2013-10-31 20:24:59 UTC (rev 2641)
+++ pkg/vegan/vignettes/decision-vegan.Rnw	2013-11-03 14:34:20 UTC (rev 2642)
@@ -92,10 +92,8 @@
 package is loaded.
 
 \R{} allows\footnote{Since \R{} version 2.15.0.}
-setting up a default socket cluster (\code{setDefaultCluster}).  In
-that case \pkg{vegan} will perform parallel processing with that
-default cluster.  If the \code{mc.cores} is also set, it takes
-precedence.
+setting up a default socket cluster (\code{setDefaultCluster}), but
+this will not be used in \pkg{vegan}. 
 
 \subsubsection{Setting up socket clusters}
 \label{sec:parallel:socket}
@@ -201,31 +199,7 @@
 \begin{enumerate} 
 \item \code{NULL}: The function is called with argument \code{parallel
     = getOption("mc.cores")}. The option \code{mc.cores} is normally
-  unset and then the default is \code{parallel = NULL}.  This is
-  interpreted as \code{parallel = 1} in \R-2.14.x.  In \R-2.15.x the
-  function inspects if a default socket cluster is defined.  \R-2.15.0
-  has a non-exported environment \code{parallel:::.reg} with variable
-  \code{default} that is either \code{NULL} (default) or a socket
-  cluster.  Querying this environment is an error in \R-2.14.x so that
-  we also need to test the \R{} version.  In the following
-  \code{oecosimu} code we first see if the default cluster is set when
-  \code{parallel = NULL}, and if it is unset, the \code{parallel} will
-  still be \code{NULL} and will be changed to \code{1}.  After this,
-  the value of \code{parallel} will be either an integer or a socket
-  cluster, and information on the type is saved in variable
-  \code{hasClus}:
-\begin{Schunk}
-\begin{Soutput}
-if(is.null(parallel) && 
-   getRversion() >= "2.15.0")
-     parallel <- get("default", 
-                 envir = parallel:::.reg)
-if (is.null(parallel) || 
-    getRversion() < "2.14.0")
-      parallel <- 1
-hasClus <- inherits(parallel, "cluster")
-\end{Soutput}
-\end{Schunk}
+  unset and then the default is \code{parallel = NULL}.  
 \item Integer: An integer value is taken as the number of created
   parallel processes.  In unix-like systems this is the number of
   forked multicore processes, and in Windows this is the number of
@@ -244,16 +218,12 @@
   \item Explicitly given argument value of \code{parallel} will always
     be used.
   \item If \code{mc.cores} is set, it will be used. In Windows this
-    means creating and stopping socket clusters even when a default
-    cluster is set if \code{mc.cores} is not \code{NULL}. Please note
+    means creating and stopping socket clusters. Please note
     that the \code{mc.cores} is only set from the environmental
     variable \code{MC_CORES} when you load the \pkg{parallel} package,
     and it is always unset before first
-    \code{require(parallel)}.\footnote{The behaviour of
-      \code{mc.cores} option is untested in Windows.}
-  \item The default socket cluster will be used if
-    set.\footnote{Default cluster is available since \R{} 2.15.0.}
-  \item The fall back behaviour is no parallel processing. 
+    \code{require(parallel)}.
+ \item The fall back behaviour is no parallel processing. 
 \end{enumerate}
 
 \section{Nestedness and Null models}



More information about the Vegan-commits mailing list