pvmhosts
:
This is the file that tellsariessrv aries3 aries4 aries5 aries6 aries7 aries8 aries9 aries1 aries2 aries10 aries11 aries12 aries13 aries14 aries15 aries16 aries17 aries18 aries19 aries20 aries21 aries22 aries23
pvm
what machines to use in its cluster.
Second, run this at a shell prompt:
This command starts the cluster with the machines specified in$ pvm pvmhosts
pvmhosts
.
At the pvm>
prompt, you can do:
to verify that the cluster is correctly set up. The output should look similar to this:pvm> conf
pvm> conf conf 24 hosts, 1 data format HOST DTID ARCH SPEED DSIG ariessrv 40000 LINUX 1000 0x00408841 aries1 80000 LINUX 1000 0x00408841 aries2 c0000 LINUX 1000 0x00408841 aries3 100000 LINUX 1000 0x00408841 aries4 140000 LINUX 1000 0x00408841 aries5 180000 LINUX 1000 0x00408841 aries6 1c0000 LINUX 1000 0x00408841 aries7 200000 LINUX 1000 0x00408841 aries8 240000 LINUX 1000 0x00408841 aries9 280000 LINUX 1000 0x00408841 aries10 2c0000 LINUX 1000 0x00408841 aries11 300000 LINUX 1000 0x00408841 aries12 340000 LINUX 1000 0x00408841 aries13 380000 LINUX 1000 0x00408841 aries14 3c0000 LINUX 1000 0x00408841 aries15 400000 LINUX 1000 0x00408841 aries16 440000 LINUX 1000 0x00408841 aries17 480000 LINUX 1000 0x00408841 aries18 4c0000 LINUX 1000 0x00408841 aries19 500000 LINUX 1000 0x00408841 aries20 540000 LINUX 1000 0x00408841 aries21 580000 LINUX 1000 0x00408841 aries22 5c0000 LINUX 1000 0x00408841 aries23 600000 LINUX 1000 0x00408841
At this point, hit Ctrl-D
to exit PVM. You should notice a message about
pvmd
still running. This is because even though you have exit the controlling
terminal, the cluster is still active. You can confirm this by running pvm
again;
it should connect to the still-running cluster, and you should be able to verify this by running
the conf
command. Keep in mind:
is to start a cluster, but only$ pvm pvmhosts
is needed to connect to an existing one.$ pvm
To halt the cluster, use the command halt
at the pvm>
prompt. This
will kill the pvmd
on every machine and cleanly exit. You should always use this
when you are done running your simulations. Additionally, should your simulation ever crash, it
is advisable to restart the cluster using halt
from inside pvm
and
pvm pvmhosts
from the shell.
library(snow)
To set up an RPVM cluster through SNOW, use the following command:
In this code,cl_pvm <-makeCluster(nclus, type = "PVM");
cl_pvm
is the variable that represents your cluster, and
nclus
is the number of nodes you want in the cluster. Note that this need not be
the same number as the number of hosts in your pvmhosts
file. You can think
of the RPVM cluster as being built on top of the PVM cluster you built in the previous
section. It must be started and stopped separately, from within R. As such, the nodes in the
RPVM cluster may be a subset of the nodes in the PVM cluster.
To stop an RPVM cluster, use the command:
wherestopCluster(cl_pvm);
cl_pvm
is the same variable as you used before for your cluster.
To run a function over the cluster, the clusterCall
comnmand is used.
The syntax for this command is as follows:
In this code,clusterCall(cl_pvm, cluster_func, ...)
cl_pvm
is the same variable as you used before for your cluster,
cluster_func
is the function you wish to distribute over the cluster, and
...
are the arguments to that function. For example, if you had a function
F = function(x, y)
, you might run it sequentially like this:
To run the same thing over the cluster, you would do:F(1, 2)
clusterCall(cl_pvm, F, x=1, y=2)