|Knowledge Center Contents Previous Next Index|
This chapter describes
lstcsh, an extended version of the
tcshcommand interpreter. The
lstcshinterpreter provides transparent load sharing of user jobs.
This chapter is not a general description of the
tcshshell. Only load sharing features are described in detail.
Interactive tasks, including
lstcsh, are not supported on Windows.
- About lstcsh
- Starting lstcsh
- Using lstcsh as Your Login Shell
- Host Redirection
- Task Control
- Built-in Commands
- Writing Shell Scripts in lstcsh
lstcshshell is a load-sharing version of the
tcshcommand interpreter. It is compatible with
cshand supports many useful extensions.
tcshusers can use
lstcshto send jobs to other hosts in the cluster without needing to learn any new commands. You can run
lstcshfrom the command-line, or use the
chshcommand to set it as your login shell.
lstcsh, your commands are sent transparently for execution on faster hosts to improve response time or you can run commands on remote hosts explicitly.
lstcsh provides a high degree of network transparency. Command lines executed on remote hosts behave the same as they do on the local host. The remote execution environment is designed to mirror the local one as closely as possible by using the same values for environment variables, terminal setup, current working directory, file creation mask, and so on. Each modification to the local set of environment variables is automatically reflected on remote hosts. Note that shell variables, the nice value, and resource usage limits are not automatically propagated to remote hosts.
For more details on
lstcsh, see the
In this section
LSF maintains two task lists for each user, a local list (
.lsftask) and a remote list (
lsf.task). Commands in the local list must be executed locally. Commands in the remote list can be executed remotely.
Platform LSF Configuration Referencefor information about the
Changing task list membership
You can use the LSF commands
lsrtasksto inspect and change the memberships of the local and remote task lists.
Task lists and resource requirements
Resource requirements for specific commands can be configured using task lists. You can optionally associate resource requirements with each command in the remote list to help LSF find a suitable execution host for the command.
If there are multiple eligible commands on a command-line, their resource requirements are combined for host selection.
If a command is in neither list, you can choose how
lstcshhandles the command.
Local and Remote Modes
lstcshhas two modes of operation:
The local mode is the default mode. In local mode, a command line is eligible for remote execution only if all of the commands on the line are present in the remote task list, or if the
@character is specified on the command-line to force it to be eligible.
See @ character for more details.
Local mode is conservative and can fail to take advantage of the performance benefits and load-balancing advantages of LSF.
In remote mode, a command line is considered eligible for remote execution if none of the commands on the line is in the local task list.
Remote mode is aggressive and makes more extensive use of LSF. However, remote mode can cause inconvenience when
lstcshattempts to send host-specific commands to other hosts.
Automatic Remote Execution
Every time you enter a command,
lstcshlooks in your task lists to determine whether the command can be executed on a remote host and to find the configured resource requirements for the command.
Platform LSF Configuration Referencefor information about task lists and
If the command can be executed on a remote host,
lstcshcontacts LIM to find the best available host.
The first time a command is run on a remote host, a server shell is started on that host. The command is sent to the server shell, and the server shell starts the command on the remote host. All commands sent to the same host use the same server shell, so the start-up overhead is only incurred once.
If no host is found that meets the resource requirements of your command, the command is run on the local host.
Differences from Other Shells
When a command is running in the foreground on a remote host, all keyboard input (type-ahead) is sent to the remote host. If the remote command does not read the input, it is lost.
lstcshhas no way of knowing whether the remote command reads its standard input. The only way to provide any input to the command is to send everything available on the standard input to the remote command in case the remote command needs it. As a result, any type-ahead entered while a remote command is running in the foreground, and not read by the remote command, is lost.
@character has a special meaning when it is preceded by white space. This means that the
@must be escaped with a backslash
\to run commands with arguments that start with
finger. This is an example of using
fingerto get a list of users on another host:
fingercommand attempts to contact the named host. Under
@character is interpreted as a request for remote execution, so the shell tries to contact the RES on the host
other.domainto remotely execute the
fingercommand. If this host is not in your LSF cluster, the command fails. When the
@character is escaped, it is passed to
fingerbehaves as expected.
A shell is a very complicated application by itself.
lstcshhas certain limitations:
Native language system
Native Language System is not supported. To use this feature of the
tcsh, you must compile
tcshwith SHORT_STRINGS defined. This causes complications for characters flowing across machines.
Shell variables are not propagated across machines. When you set a shell variable locally, then run a command remotely, the remote shell will not see that shell variable. Only environment variables are automatically propagated.
fgcommand for remote jobs must use
@, as shown by examples in Task Control.
lstcshis based on
tcsh 6.03(7 bit mode). It does not support the new features of the latest
If you normally use some other shell, you can start
lstcshfrom the command-line.
- Make sure that the LSF commands are in your PATH environment variable, then enter:
If you have a
.cshrcfile in your home directory,
lstcshreads it to set variables and aliases.
- Use the
exitcommand to get out of
Using lstcsh as Your Login Shell
If your system administrator allows, you can use LSF as your login shell. The
/etc/shellsfile contains a list of all the shells you are allowed to use as your login shell.
Set your login shell
chshcommand can set your login shell to any of those shells. If the
/etc/shellsfile does not exist, you cannot set your login shell to
- Run the command:
chsh user3 /usr/share/lsf/bin/lstcsh
The next time
user3logs in, the login shell will be
Using a standard system shell
if you cannot set your login shell using
chsh, you can use one of the standard system shells to start
lstcshwhen you log in.
To set up
lstcshto start when you log in:
/bin/shto be your login shell.
- Edit the
.profilefile in your home directory to start
lstcsh, as shown below:SHELL=/usr/share/lsf/bin/lstcsh export SHELL exec $SHELL -l
Host redirection overrides the task lists, so you can force commands from your local task list to execute on a remote host or override the resource requirements for a command.
You can explicitly specify the eligibility of a command-line for remote execution using the
@character. It may be anywhere in the command line except in the first position (
@as the first character on the line is used to set the value of shell variables).
You can restrict who can use
@for host redirection in
lstcshwith the parameter LSF_SHELL_AT_USERS in
lsf.conf. See the
Platform LSF Configuration Referencefor more details.
hostname @hostD<< remote execution on hostD >> hostD
hostname @/type==linux<< remote execution on hostB >> hostB
@followed by nothing means that the command line is eligible for remote execution.
@followed by a host name forces the command line to be executed on that host.
@followed by the reserved word
localforces the command line to be executed on the local host only.
/and a resource requirement string means that the command is eligible for remote execution and that the specified resource requirements must be used instead of those in the remote task list.
For ease of use, the host names and the reserved word
@can all be abbreviated as long as they do not cause ambiguity.
Similarly, when specifying resource requirements following the
@, it is necessary to use
/only if the first requirement characters specified are also the first characters of a host name. You do not have to type in resource requirements for each command line you type if you put these task names into remote task list together with their resource requirements by running
Task control in
lstcshis the same as in
tcshexcept for remote background tasks.
lstcshnumbers shell tasks separately for each execution host.
The output of the built-in command
jobslists background tasks together with their execution hosts. This break of transparency is intentional to give you more control over your background tasks.
sleep 30 @hostD &<< remote execution on hostD >>  27568
sleep 40 @hostD &<< remote execution on hostD >>  10280
sleep 60 @hostB &<< remote execution on hostB >>  3748
jobs<hostD>  + Running sleep 30  Running sleep 40 <hostB>  + Running sleep 60
Bring a remote background task to the foreground
- To bring a remote background task to the foreground, the host name must be specified together with
@, as in the following example:
fg %2 @hostD
<< remote execution on hostD >>
lstcshsupports two built-in commands to control load sharing,
In this section
lsmodecommand reports that LSF is enabled if
lstcshwas able to contact LIM when it started up. If LSF is disabled, no load-sharing features are available.
lsmodecommand takes a number of arguments that control how
With no arguments,
lsmodedisplays the current settings:
lsmodeLSF Copyright Platform Computing Corporation LSF enabled, local mode, LSF on, verbose, no_eligibility_verbose, no timing.
Turns load sharing on or off. When turned off, you can send a command line to a remote host only if force eligibility is specified with @.
The default is on.
lstcshto use local or remote mode.
The default is local. See Local and Remote Modes for a description of local and remote modes.
Turns eligibility verbose mode on (
e) or off (
-e). If eligibility verbose mode is on,
lstcshshows whether the command is eligible for remote execution, and displays the resource requirement used if the command is eligible.
The default is off.
Turns task placement verbose mode on (
v) or off (
-v). If verbose mode is on,
lstcshdisplays the name of the host on which the command is run, if the command is not run on the local host. The default is on.
Turns wall-clock timing on (
t) or off (
If timing is on, the actual response time of the command is displayed. This is the total elapsed time in seconds from the time you submit the command to the time the prompt comes back.
This time includes all remote execution overhead. The
cshtime builtin does not include the remote execution overhead.
This is an impartial way of comparing the response time of jobs submitted locally or remotely, because all the load sharing overhead is included in the displayed elapsed time.
The default is off.
lstcshopens a connection to a remote host when the first command is executed remotely on that host. The same connection is used for all future remote executions on that host.
connectcommand with no argument displays connections that are currently open.
connect host_namecommand creates a connection to the named host. By connecting to a host before any command is run, the response time is reduced for the first remote command sent to that host.
lstcshhas a limited number of ports available to connect to other hosts. By default each shell can only connect to 15 other hosts.
connectCONNECTED WITH SERVER SHELL hostA +
connect hostBConnected to hostB
connectCONNECTED WITH SERVER SHELL hostA + hostB -
In this example, the
connectcommand created a connection to host
hostB, but the server shell has not started.
Writing Shell Scripts in lstcsh
You should write shell scripts in
/bin/shand use the
lstoolscommands for load sharing. However,
lstcshcan be used to write load-sharing shell scripts.
By default, an
lstcshscript is executed as a normal
tcshscript with load-sharing disabled.
Run a script with load sharing enabled
lstcsh -Loption tells
lstcshthat a script should be executed with load sharing enabled, so individual commands in the script may be executed on other hosts.
There are three different ways to run an
lstcshscript with load sharing enabled:
- Make the script executable and put the following as the first line of the script. By default,
lstcshis installed in LSF_BINDIR.
The following assumes you installed
- Start an interactive
- Enable load sharing, and set to remote mode:
lsmode on remote
- Use the
sourcecommand to read the script in.
Platform Computing Inc.
|Knowledge Center Contents Previous Next Index|