Scyld ClusterWare HPC: User's Guide | ||
---|---|---|
<< Previous | Interacting With the System | Next >> |
When you log into the cluster, you are actually logging into the master node, and the commands you enter on the command line will execute on the master node. The only exception is when you use special commands for interacting with the compute nodes, as described in the next section.
Scyld ClusterWare provides the bpsh command for running jobs on the compute nodes. bpsh is a replacement for the traditional Unix utility rsh, used to run a job on a remote computer. Like rsh, the bpsh arguments are the node on which to run the command and the command. bpsh allows you to run a command on more than one node without having to type the command once for each node, but it doesn't provide an interactive shell on the remote node like rsh does.
bpsh is primarily intended for running utilities and maintenance tasks on a single node or a range of nodes, rather than for running parallel programs. For information on running parallel programs with Scyld ClusterWare, see the Chapter called Running Programs.
bpsh provides a convenient yet powerful interface for manipulating all (or a subset of) the cluster's nodes simultaneously. bpsh provides you the flexibility to access a compute node individually, but removes the requirement to access each node individually when a collective operation is desired. A number of examples and options are discussed in the sections that follow. For a complete reference to all the options available for bpsh, see the Reference Guide.
Example 1. Checking for a File
You can use bpsh to check for specific files on a compute node. For example, to check for a file named output in the /tmp directory of node 3, you would run the following command on the master node:
[user@cluster user] $ bpsh 3 ls /tmp/output |
The command output would appear on the master node terminal where you issued the command.
Example 2. Running a Command on a Range of Nodes
You can run the same command on a range of nodes using bpsh. For example, to check for a file named output in the /tmp directory of nodes 3 through 5, you would run the following command on the master node:
[user@cluster user] $ bpsh 3,4,5 ls /tmp/output |
Example 3. Running a Command on All Available Nodes
Use the -a flag to indicate to bpsh that you wish to run a command on all available nodes. For example, to check for a file named output in the /tmp directory of all nodes currently active in your cluster, you would run the following command on the master node:
[user@cluster user] $ bpsh -a ls /tmp/output |
Note that when using the -a flag, the results are sorted by the response speed of the compute nodes, and are returned without node identifiers. Because this command will produce output for every currently active node, the output may be hard to read if you have a large cluster. For example, if you ran the above command on a 64-node cluster in which half of the nodes have the file being requested, the results returned would be 32 lines of /tmp/output and another 32 lines of ls: /tmp/output: no such file or directory. Without node identifiers, it is impossible to ascertain the existence of the target file on a particular node.
See the next section for bpsh options that enable you to format the results for easier reading.
The bpsh command has a number of options for formatting its output to make it more useful for the user, including the following:
The -L option makes bpsh wait for a full line from a compute node before it prints out the line. Without this option, the output from your command could include half a line from node 0 with a line from node 1 tacked onto the end, then followed by the rest of the line from node 0.
The -p option prefixes each line of output with the node number of the compute node that produced it. This option causes the functionality for -L to be used, even if not explicitly specified.
The -s option forces the output of each compute node to be printed in sorted numerical order, rather than by the response speed of the compute nodes. With this option, all the output for node 0 will appear before any of the output for node 1. To add a divider between the output from each node, use the -d option.
Using -d generates a divider between the output from each node. This option causes the functionality for -s to be used, even if not explicitly specified.
For example, if you run the command bpsh -a -d -p ls /tmp/output on an 8-node cluster, the output would make it clear which nodes do and do not have the file output in the /tmp directory, for example:
0 --------------------------------------------------------------------- /tmp/output 1 --------------------------------------------------------------------- 1: ls: /tmp/output: No such file or directory 2 --------------------------------------------------------------------- 2: ls: /tmp/output: No such file or directory 3 --------------------------------------------------------------------- 3: /tmp/output 4 --------------------------------------------------------------------- 4: /tmp/output 5 --------------------------------------------------------------------- 5: /tmp/output 6 --------------------------------------------------------------------- 6: ls: /tmp/output: No such file or directory 7 --------------------------------------------------------------------- 7: ls: /tmp/output: No such file or directory |
Special shell features, such as piping and input/output redirection, are available to advanced users. This section provides several examples of shell interaction, using the following conventions:
The command running will be cmda.
If it is piped to anything, it will be piped to cmdb.
If an input file is used, it will be /tmp/input.
If an output file is used, it will be /tmp/output.
The node used will always be node 0.
Example 4. Command on Compute Node, Output on Master Node
The easiest case is running a command on a compute node and doing something with its output on the master node, or giving it input from the master. Following are a few examples:
[user@cluster user] $ bpsh 0 cmda | cmdb [user@cluster user] $ bpsh 0 cmda > /tmp/output [user@cluster user] $ bpsh 0 cmda < /tmp/input |
Example 5. Command on Compute Node, Output on Compute Node
A bit more complex situation is to run the command on the compute node and do something with its input (or output) on that same compute node. There are two ways to accomplish this.
The first solution requires that all the programs you run be on the compute node. For this to work, you must first copy the cmda and cmdb executable binaries to the compute node. Then you would use the following commands:
[user@cluster user] $ bpsh 0 sh -c "cmda | cmdb" [user@cluster user] $ bpsh 0 sh -c "cmda > /tmp/output" [user@cluster user] $ bpsh 0 sh -c "cmda < /tmp/input" |
The second solution doesn't require any of the programs to be on the compute node. However, it uses a lot of network bandwidth as it takes the output and sends it to the master node, then sends it right back to the compute node. The appropriate commands are as follows:
[user@cluster user] $ bpsh 0 cmda | bpsh 0 cmdb [user@cluster user] $ bpsh 0 cmda | bpsh 0 dd of=/tmp/output [user@cluster user] $ bpsh 0 cat /tmp/input | bpsh 0 cmda |
Example 6. Command on Master Node, Output on Compute Node
You can also run a command on the master node and do something with its input or output on the compute nodes. The appropriate commands are as follows:
[user@cluster user] $ cmda | bpsh 0 cmdb [user@cluster user] $ cmda | bpsh 0 dd of=/tmp/output [user@cluster user] $ bpsh 0 cat /tmp/input | cmda |
<< Previous | Home | Next >> |
Monitoring Node Status | Up | Copying Data to the Compute Nodes |