What you need to launch subkernels across several nodes on a HPC cluster is the following:
- Figure out how to request several compute nodes for the same job
- Find the names of the nodes that have been allocated for your job
- Find out how to launch subkernels on these nodes from within the main kernel
All of these depend on the grid engine your cluster is using, as well as your local setup, and you'll need to check its docs and ask your administrator about the details. I have an example for our local setup (complete with a jobfile), which might be helpful for you to study:
https://bitbucket.org/szhorvat/crc/src
Our cluster uses the Sun Grid Engine. The names of the nodes (and information about them) are listed in a "hostfile" which you can find by retrieving the value of the PE_HOSTFILE
environment variable. (I think this works the same way with PBS, except the environment variable is called something else.)
Note that if you request multiple nodes in a single job file, the job script will be run on only one of the nodes, and you'll be launching the processes across all nodes manually (at least on SGE and PBS).
Launching processes on different nodesLaunching processes on different nodes is usually possible with ssh
: just run ssh nodename command
to run command
. You may also need to set up passphraseless authentication if it is not set up by default. To launch subkernels, you'll need to pass the -f
option to ssh
to let it return immediately after it has launched the remote process.
Some setups use rsh
instead of ssh
. To launch a command in the background using rsh
, you'll need to do
rsh -n nodename "command >& /dev/null &"
To run the remote process in the background, it important to redirect the output (both stdout and stderr) because there's a bug in rsh (also described in its man page) that won't let it return immediately otherwise.
Another thing to keep in mind about rsh
is that you can't rsh
to the local machine, so you'll need to launch the subkernels which will run on the same machine as the main kernel without rsh
.
See my example for details.