Package: parallelly
===================

Version: 1.23.0 [2021-01-03]

NEW FEATURES:

 * availableCores(), availableWorkers(), and freeCores() gained argument
   'logical', which is passed down to parallel::detectCores() as-is.
   The default is TRUE but it can be changed by setting the R option
   'parallelly.availableCores.logical'.  This option can in turn be set via
   environment variable 'R_PARALLELLY_AVAILABLECORES_LOGICAL' which is
   applied (only) when the package is loaded.

 * Now makeClusterPSOCK() asserts that there are enough free connections
   available before attempting to create the parallel workers.  If too many
   workers are requested, an informative error message is produced.
 
 * Add availableConnections() and freeConnections() to infer the maximum number
   of connections that the current R installation can have open at any time
   and how many of those are currently free to be used.  This limit is
   typically 128 but may be different in custom R installations that are built
   from source.


Version: 1.22.0 [2020-12-12]

NEW FEATURES:

 * Now availableCores() queries also Unix command 'nproc', if available. This
   will make it respect the number of CPU/cores limited by 'cgroups' and Linux
   containers.

 * PSOCK cluster workers are now set up to communicate using little endian
   (useXDR = FALSE) instead of big endian (useXDR = TRUE).  Since most modern
   systems use little endian, 'useXDR = FALSE' speeds up the communication
   noticeably (10-15%) on those systems.  The default value of this argument
   can be controlled by the R option 'parallelly.makeNodePSOCK.useXDR' or the
   corresponding environment variable 'R_PARALLELLY_MAKENODEPSOCK_USEXDR'.

BETA FEATURES:

 * Add cpuLoad() for querying the "average" system load on Unix-like systems.

 * Add freeCores() for estimating the average number of unused cores based
   on the average system load as given by cpuLoad().

BUG FIXES:

 * Except for environment variables 'R_FUTURE_AVAILABLECORES_FALLBACK' and
   'R_FUTURE_AVAILABLECORES_SYSTEM', none of the 'R_PARALLELLY_*' and
   'R_FUTURE_*' ones where recognized.
   

Version: 1.21.0 [2020-10-26]

SIGNIFICANT CHANGES:

 * Removed find_rshcmd() which was never meant to be exported.
 
NEW FEATURES:

 * makeClusterPSOCK() gained argument 'validate' to control whether or not the
   nodes should be tested after they've been created.  The validation is done
   by querying each node for its session information, which is then saved as
   attribute 'session_info' on the cluster node object.  This information is
   also used in error messages, if available.  This validation has been done
   since version 1.5.0 but now it can be disabled.  The default of argument
   'validate' can be controlled via an R options and an environment variable.

 * Now makeNodePSOCK(..., rscript_envs = "UNKNOWN") produces an informative
   warning on non-existing environment variables that was skipped.

BUG FIXES:

 * makeClusterPSOCK() would produce an error on 'one node produced an error:
   could not find function "getOptionOrEnvVar"' if 'parallelly' is not
   available on the node.

 * makeClusterPSOCK() would attempt to loaded 'parallelly' on the worker.
   If it's not available on the worker, it would result in a silent warning
   on the worker.  Now 'parallelly' is not loaded.

 * makeClusterPSOCK(..., tries = n) would retry to setup a cluster node also
   on errors that were unrelated to node setup or node connection errors.

 * The error message on using an invalid 'rscript_envs' argument for
   makeClusterPSOCK() reported on the value of 'rscript_libs' (sic!).
 
 * makeNodePSOCK(..., rscript_envs = "UNKNOWN") would result in an error when
   trying to launch the cluster node.

DEPRECATED AND DEFUNCT:

 * Removed find_rshcmd() which was never meant to be exported.
 

Version: 1.20.0 [2020-10-10]

SIGNIFICANT CHANGES:

 * Add availableCores(), and availableWorkers(), supportsMulticore(),
   as.cluster(), autoStopCluster(), makeClusterMPI(), makeClusterPSOCK(),
   and makeNodePSOCK() from the 'future' package.

NEW FEATURES:

 * Add isConnectionValid() and connectionId() adopted from internal code
   of the 'future' package.
 
BUG FIXES:

 * Renamed environment variable 'R_FUTURE_MAKENODEPSOCK_tries' used by
   makeClusterPSOCK() to 'R_FUTURE_MAKENODEPSOCK_TRIES'.

 * connectionId() did not return -1L on Solaris for connections with internal
   'nil' pointers because they were reported as '0' - not 'nil' or '0x0'.

HISTORY:

 * Below is an excerpt of the future's NEWS entries that are related to the
   functions in this package.


Version: 1.19.0 [2020-09-19]

SIGNIFICANT CHANGES:

 * Now availableCores() better supports Slurm.  Specifically, if environment
   variable 'SLURM_CPUS_PER_TASK' is not set, which requires that option
   --slurm-cpus-per-task=n' is specified and SLURM_JOB_NUM_NODES=1, then it
   falls back to using 'SLURM_CPUS_ON_NODE', e.g. when using '--ntasks=n'.

 * Now availableCores() and availableWorkers() supports LSF/OpenLava.
   Specifically, they acknowledge environment variable 'LSB_DJOB_NUMPROC'
   and 'LSB_HOSTS', respectively.

NEW FEATURES:

 * makeClusterPSOCK() will now retry to create a cluster node up to 'tries'
   (default: 3) times before giving up.  If argument 'port' species more than
   one port (e.g. port = "random") then it will also attempt find a valid
   random port up to 'tries' times before giving up.  The pre-validation of
   the random port is only supported in R (>= 4.0.0) and skipped otherwise.

 * makeClusterPSOCK() skips shell quoting of the elements in 'rscript' if it
   inherits from 'AsIs'.

 * makeClusterPSOCK(), or actually makeNodePSOCK(), gained argument 'quiet',
   which can be used to silence output produced by 'manual = TRUE'.

PERFORMANCE:

 * Now plan(multisession), plan(cluster, workers = <number>), and
   makeClusterPSOCK() which they both use internally, sets up localhost
   workers twice as fast compared to versions since future 1.12.0, which
   brings it back to par with a bare-bone parallel::makeCluster(...,
   setup_strategy = "sequential") setup.  The slowdown was introduced in
   future 1.12.0 (2019-03-07) when protection against leaving stray R
   processes behind from failed worker startup was implemented.  This
   protection now makes use of memoization for speedup.


Version: 1.18.0 [2020-07-08]

NEW FEATURES:

 * print() on RichSOCKcluster gives information not only on the name of the
   host but also on the version of R and the platform of each node ("worker"),
   e.g. "Socket cluster with 3 nodes where 2 nodes are on host 'localhost' (R
   version 4.0.0 (2020-04-24), platform x86_64-w64-mingw32), 1 node is on host
   'n3' (R version 3.6.3 (2020-02-29), platform x86_64-pc-linux-gnu)".

 * It is now possible to set environment variables on workers before they are
   launched by makeClusterPSOCK() by specify them as as "<name>=<value>"
   as part of the 'rscript' vector argument, e.g. rscript=c("ABC=123",
   "DEF='hello world'", "Rscript"). This works because elements in 'rscript'
   that match regular expression '^[[:alpha:]_][[:alnum:]_]*=.*' are no longer
   shell quoted.

 * makeClusterPSOCK() now returns a cluster that in addition to inheriting
   from' SOCKcluster' it will also inherit from 'RichSOCKcluster'.

BUG FIXES:

 * Made makeClusterPSOCK() and makeNodePSOCK() agile to the name change from
   parallel:::.slaveRSOCK() to parallel:::.workRSOCK() in R (>= 4.1.0).

 * makeClusterPSOCK(..., rscript) will not try to locate rscript[1] if
   argument 'homogeneous' is FALSE (or inferred to be FALSE).

 * makeClusterPSOCK(..., rscript_envs) would result in a syntax error when
   starting the workers due to non-ASCII quotation marks if option
   'useFancyQuotes' was not set to FALSE.


Version: 1.17.0 [2020-04-17]

NEW FEATURES:

 * makeClusterPSOCK() gained argument 'rscript_envs' for setting environment
   variables in workers on startup, e.g. rscript_envs = c(FOO = "3.14", "BAR").

MISCELLANEOUS:

 * Not all CRAN servers have _R_CHECK_LIMIT_CORES_ set.  To better emulate
   CRAN submission checks, the future package will, when loaded, set this
   environment variable to 'TRUE' if unset and if 'R CMD check' is running.
   Note that future::availableCores() respects _R_CHECK_LIMIT_CORES_ and
   returns at most 2L (two cores) if detected.


Version: 1.15.1 [2019-11-23]

NEW FEATURES:

 * The default range of ports that makeClusterPSOCK() draws a random port from
   (when argument 'port' is not specified) can now be controlled by environment
   variable `R_FUTURE_RANDOM_PORTS`.  The default range is still 11000:11999
   as with the 'parallel' package.


Version: 1.15.0 [2019-11-07]

DOCUMENTATION:

 * Added 'Troubleshooting' section to ?makeClusterPSOCK with instructions on
   how to troubleshoot when the setup of local and remote clusters fail.

BUG FIXES:

 * makeClusterPSOCK() could produce warnings like "cannot open file
   '/tmp/alice/Rtmpi69yYF/future.parent=2622.a3e32bc6af7.pid': No such file",
   e.g. when launching R workers running in Docker containers.
   
 * makeClusterMPI() did not work for MPI clusters with 'comm' other than '1'.


Version: 1.13.0 [2019-05-08]

NEW FEATURES:

 * Now availableCores() also recognizes PBS environment variable 'NCPUS',
   because the PBSPro scheduler does not set 'PBS_NUM_PPN'.

 * If, option 'future.availableCores.custom' is set to a function, then
   availableCores() will call that function and interpret its value as
   number of cores.  Analogously, option 'future.availableWorkers.custom'
   can be used to specify a hostnames of a set of workers that
   availableWorkers() sees.  These new options provide a mechanism for anyone
   to customize availableCores() and availableWorkers() in case they do not
   (yet) recognize, say, environment variables that are specific the user's
   compute environment or HPC scheduler.

 * makeClusterPSOCK() gained support for argument 'rscript_startup' for
   evaluating one or more R expressions in the background R worker prior
   to the worker event loop launching.  This provides a more convenient
   approach than having to use, say, 'rscript_args = c("-e", sQuote(code))'.

 * makeClusterPSOCK() gained support for argument 'rscript_libs' to control the
   R package library search path on the workers.  For example, to _prepend_ the
   folder '~/R-libs' on the workers, use 'rscript_libs = c("~/R-libs", "*")',
   where "*" will be resolved to the current '.libPaths()' on the workers.

BUG FIXES:

 * makeClusterPSOCK() did not shell quote the Rscript executable when running
   its pre-tests checking whether localhost Rscript processes can be killed by
   their PIDs or not.


Version: 1.12.0 [2019-03-07]

NEW FEATURES:

 * If makeClusterPSOCK() fails to create one of many nodes, then it will
   attempt to stop any nodes that were successfully created.  This lowers
   the risk for leaving R worker processes behind.
 
BUG FIXES:

 * makeClusterPSOCK() in future (>= 1.11.1) produced warnings when argument
   'rscript' had length(rscript) > 1.


Version: 1.11.1.1 [2019-01-25]

BUG FIXES:

 * When makeClusterPSOCK() fails to connect to a worker, it produces an error
   with detailed information on what could have happened.  In rare cases,
   another error could be produced when generating the information on what
   the workers PID is.
 

Version: 1.11.1 [2019-01-25]

NEW FEATURES:

 * The defaults of several arguments of makeClusterPSOCK() and makeNodePSOCK()
   can now be controlled via environment variables in addition to R options
   that was supported in the past. An advantage of using environment variables
   is that they will be inherited by child processes, also nested ones.

SOFTWARE QUALITY:

 * TESTS: When the 'future' package is loaded, it checks whether 'R CMD check'
   is running or not.  If it is, then a few future-specific environment
   variables are adjusted such that the tests play nice with the testing
   environment.  For instance, it sets the socket connection timeout for
   PSOCK cluster workers to 120 seconds (instead of the default 30 days!).
   This will lower the risk for more and more zombie worker processes
   cluttering up the test machine (e.g. CRAN servers) in case a worker process
   is left behind despite the main R processes is terminated.  Note that these
   adjustments are applied automatically to the checks of any package that
   depends on, or imports, the 'future' package.

BUG FIXES:

 * Whenever makeClusterPSOCK() would fail to connect to a worker, for instance
   due to a port clash, then it would leave the R worker process running - also
   after the main R process terminated.  When the worker is running on the same
   machine, makeClusterPSOCK() will now attempt to kill such stray R processes.
   Note that parallel::makePSOCKcluster() still has this problem.


Version: 1.11.0 [2019-01-21]

NEW FEATURES:

 * makeClusterPSOCK() produces more informative error messages whenever the
   setup of R workers fails.  Also, its verbose messages are now prefixed
   with "[local output] " to help distinguish the output produced by the
   current R session from that produced by background workers.
   
 * It is now possible to specify what type of SSH clients makeClusterPSOCK()
   automatically searches for and in what order, e.g.
   'rshcmd = c("<rstudio-ssh>", "<putty-plink>")'.

 * Now makeClusterPSOCK() preserves the global RNG state (.Random.seed) also
   when it draws a random port number.
   
 * makeClusterPSOCK() gained argument 'rshlogfile'.

BUG FIXES:

 * makeClusterPSOCK(..., rscript = "my_r") would in some cases fail to find
   the intended 'my_r' executable.


Version: 1.10.0 [2018-10-16]

NEW FEATURES:

 * Add makeClusterMPI(n) for creating MPI-based clusters of a similar kind as
   parallel::makeCluster(n, type = "MPI") but that also attempts to workaround
   issues where parallel::stopCluster() causes R to stall.
   
 * makeClusterPSOCK() and makeClusterMPI() gained argument 'autoStop' for
   controlling whether the cluster should be automatically stopped when
   garbage collected or not.


Version: 1.9.0 [2018-07-22]

BUG FIXES:

 * makeClusterPSOCK() produced a warning when environment variable
   'R_PARALLEL_PORT' was set to 'random' (e.g. as on CRAN).


Version: 1.8.1 [2018-05-02]

NEW FEATURES:

 * makeClusterPSOCK() now produces a more informative warning if environment
   variable R_PARALLEL_PORT specifies a non-numeric port.


Version: 1.7.0 [2018-02-10]

NEW FEATURES:

 * On Windows, makeClusterPSOCK(), and therefore plan(multisession) and
   plan(multiprocess), will use the SSH client distributed with RStudio as
   a fallback if neither 'ssh' nor 'plink' is available on the system PATH.

BUG FIXES:

 * makeClusterPSOCK(..., renice = 19) would launch each PSOCK worker via
   'nice +19' resulting in the error "nice: '+19': No such file or directory".
   This bug was inherited from parallel::makePSOCKcluster().  Now using
   'nice --adjustment=19' instead.


Version: 1.5.0 [2017-05-24]

NEW FEATURES:

 * makeClusterPSOCK() now defaults to use the Windows PuTTY software's SSH
   client 'plink -ssh', if 'ssh' is not found.

 * Argument 'homogeneous' of makeNodePSOCK(), a helper function of
   makeClusterPSOCK(), will default to FALSE also if the hostname is a
   fully qualified domain name (FQDN), that is, it "contains periods".
   For instance, c('node1', 'node2.server.org') will use homogeneous = TRUE
   for the first worker and homogeneous = FALSE for the second.

 * makeClusterPSOCK() now asserts that each cluster node is functioning by
   retrieving and recording the node's session information including the
   process ID of the corresponding R process.

DOCUMENTATION:

 * Help on makeClusterPSOCK() gained more detailed descriptions on arguments
   and what their defaults are.
 
Version: 1.4.0 [2017-03-12]

NEW FEATURES:

 * The default values for arguments 'connectTimeout' and 'timeout' of
   makeNodePSOCK() can now be controlled via global options.

DEPRECATED AND DEFUNCT:

 * availableCores(method = "mc.cores") is now defunct in favor of "mc.cores+1".


Version: 1.3.0 [2017-01-18]

NEW FEATURES:

 * makeClusterPSOCK() treats workers that refer to a local machine by
   its local or canonical hostname as "localhost".  This avoids having
   to launch such workers over SSH, which may not be supported on all
   systems / compute cluster.

 * Added availableWorkers().  By default it returns localhost workers
   according to availableCores().  In addition, it detects common
   HPC allocations given in environment variables set by the HPC
   scheduler.
   
 * Option 'future.availableCores.fallback', which defaults to environment
   variable 'R_FUTURE_AVAILABLECORES_FALLBACK' can now be used to specify
   the default number of cores / workers returned by availableCores()
   and availableWorkers() when no other settings are available.  For
   instance, if R_FUTURE_AVAILABLECORES_FALLBACK=1 is set system wide
   in an HPC environment, then all R processes that uses availableCores()
   to detect how many cores can be used will run as single-core processes.
   Without this fallback setting, and without other core-specifying settings,
   the default will be to use all cores on the machine, which does not play
   well on multi-user systems.

BUG FIXES:

 * Creation of cluster futures (including multisession ones) would
   time out already after 40 seconds if all workers were busy.
   New default timeout is 30 days (option 'future.wait.timeout').
   
 * availableCores(methods = "_R_CHECK_LIMIT_CORES_") would give an error
   if not running R CMD check.

    
Version: 1.2.0 [2016-11-12]

NEW FEATURES:

 * Added makeClusterPSOCK() - a version of parallel::makePSOCKcluster()
   that allows for more flexible control of how PSOCK cluster workers
   are set up and how they are launched and communicated with if running
   on external machines.

 * Added generic as.cluster() for coercing objects to cluster objects
   to be used as in plan(cluster, workers = as.cluster(x)).  Also added
   a c() implementation for cluster objects such that multiple cluster
   objects can be combined into a single one.

BUG FIXES:

 * Argument 'user' to remote() was ignored (since 1.1.0).
    
    
Version: 1.1.1 [2016-10-10]

BUG FIXES:

 * For the special case where 'remote' futures use workers = "localhost"
   they (again) use the exact same R executable as the main / calling R
   session (in all other cases it uses whatever 'Rscript' is found in the
   PATH).  This was already indeed implemented in 1.0.1, but with the
   added support for reverse SSH tunnels in 1.1.0 this default behavior
   was lost.
    
    
Version: 1.1.0 [2016-10-09]

NEW FEATURES:

 * REMOTE CLUSTERS: It is now very simple to use cluster() and remote()
   to connect to remote clusters / machines.  As long as you can connect
   via ssh to those machines, it works also with these future.  The new
   code completely avoids incoming firewall and incoming port forwarding
   issues previously needed.  This is done by using reverse SSH tunneling.
   There is also no need to worry about internal or external IP numbers.


Version: 0.15.0 [2016-06-13]

NEW FEATURES:

 * Now availableCores() also acknowledges environment variable NSLOTS
   set by Sun/Oracle Grid Engine (SGE).


Version: 0.12.0 [2016-02-23]

BUG FIXES:

 * FIX: Now availableCores() returns 3L (=2L+1L) instead of 2L
   if _R_CHECK_LIMIT_CORES_ is set.


Version: 0.10.0 [2015-12-30]

NEW FEATURES:

 * Now availableCores() also acknowledges the number of CPUs
   allotted by Slurm.


Version: 0.8.0 [2015-09-06]

NEW FEATURES:

 * availableCores("mc.cores") returns getOption("mc.cores") + 1L,
   because option 'mc.cores' specifies "allowed number of _additional_
   R processes" to be used in addition to the main R process.

