Last chance! 50% off unlimited learning
Sale ends in
ergm
PackageFor estimation that require MCMC, ergm
can take advantage of multiple
CPUs or CPU cores on the system on which it runs, as well as computing
clusters. It uses package parallel
and snow
to
facilitate this, and supports all cluster types that they does.
The number of nodes used and the parallel API are controlled using the
parallel
and parallel.type
arguments passed to the
control functions, such as control.ergm
.
The ergm.getCluster
function is usually called internally by the ergm process (in ergm.getMCMCsample
) and will attempt to start the appropriate type of cluster indicated by the control.ergm
settings. The ergm.stopCluster
is helpful if the user has directly created a cluster.
Further details on the various cluster types are included below.
ergm.getCluster(control, verbose=FALSE)ergm.stopCluster(object, ...)
a control.ergm
list of parameter values from which the parallel settings should be read
an object, probably of class "cluster"
logical, should detailed status info be printed to console
not currently used
The parallel
package is used with PSOCK clusters by default,
to utilize multiple cores on a system. The number of
cores on a system can be determined with the detectCores
function.
This method works with the base installation of R on all platforms, and does not require additional software.
For more advanced applications, such as clusters that span multiple
machines on a network, the clusters can be initialized manually,
and passed into ergm
using the
parallel
control argument. See the second example below.
To use MPI to accelerate ERGM sampling, pass the control parameter
parallel.type="MPI"
.
ergm
requires the snow
and
Rmpi
packages to communicate with an MPI
cluster.
Using MPI clusters requires the system to have an existing MPI installation. See the MPI documentation for your particular platform for instructions.
To use ergm across multiple machines in a high performance computing environment, see the section "User initiated clusters" below.
A cluster can be passed into ergm
with the parallel
control parameter.
ergm
will detect the number of nodes in the cluster, and use all of them for
MCMC sampling. This method is flexible: it will accept any cluster type that is
compatible with snow
or parallel
packages. Usage examples
for a multiple-machine high performance MPI cluster can be found at the statnet wiki:
https://statnet.csde.washington.edu/trac/wiki/ergmParallel
# NOT RUN {
# Uses 2 SOCK clusters for MCMLE estimation
data(faux.mesa.high)
nw <- faux.mesa.high
fauxmodel.01 <- ergm(nw ~ edges + isolates + gwesp(0.2, fixed=TRUE),
control=control.ergm(parallel=2, parallel.type="PSOCK"))
summary(fauxmodel.01)
# }
Run the code above in your browser using DataLab