Table of Contents

Computing Environment

UNIX shell

The UNIX shell is the interface to the UNIX operating system. The HPC cluster allows use of the enhanced Bourne shell bash, the enhanced C shell tcsh, and the enhanced Korn shell zsh. IT will primarily support bash, the default shell.

For most Linux systems, the sh shell is the bash shell and the csh shell is the tcsh shell. The remainder of this document will use only bash commands.

Environment variables

Environment variables store dynamic system values that affect the user environment. For example, the PATH environment variable tells the operating system where to look for executables. Many UNIX commands and tools, such as the compilers, debuggers, profilers, editors, and applications with graphical user interfaces, often look at environment variables for information they need to function. The man pages for these programs typically have an ENVIRONMENT VARIABLES section with a list of variable names which tells how the program uses the values.

This is why we encourage users to use VALET to modify your environment versus explicitly setting environment variables.

In bash, a variable must be exported to be used as an environment variable. By convention, environment variables are all uppercase. You can display a list of currently set environment variables by typing

    env

The echo and export commands will display and set environment variables.

Command Results
echo $«varName» Display specific environment variable
export «varName»=«varValue» To set an environment variable to a value

You can display specific environment variables by typing

For example,

    echo $HOME
    export FFLAGS='-g -Wall'

The variable FFLAGS will have the value '-g -Wall' in the shell and exported to programs run from this shell.

Spaces are important. Do not put spaces around the equal sign. If the value has spaces, enclose the value in quotes.
If you see instructions that refer the setenv command, replace it with the export bash command. Make sure you use equal signs, with no spaces. The setenv csh command uses spaces instead of one equal.

This section uses the wiki's documentation conventions.

Startup and logout scripts

All UNIX systems set up a default environment and provide users with the ability to execute additional UNIX commands to alter the environment. These commands are automatically sourced (executed) by your shell and define the normal and environmental variables, command aliases, and functions you need. Additionally, there is a final system-wide startup file that automatically makes global environment changes that IT sets for all users.

You can modify the default environment by adding lines at the end of the ~/.bash_profile file and the ~/.bashrc file. These modifications affect shells started on the login node and the compute nodes. In general we recommend that you should not modify these files especially when software documentation refers to changing the PATH environment variable, instead use VALET to load the software.

You may modify the IT-supplied ~/.bash_udit file (explained here) to be able to use several IT-supplied aliases (commands) and environment settings related to your workgroup and work directory . Edit .bash_udit and follow the directions in the file to activate these options. This is the ONLY way you should set your default workgroup at login. DO NOT add the workgroup command to your .bashrc or .bash_profile as this will likely prevent you from logging in and will cause file transfer programs like WinSCP, sftp or Fetch to break.

Exiting the login session or typing the logout command executes your ~/.bash_logout file and terminates your session. Add commands to ~/.bash_logout that you want to execute at logout.

To restore the .bash_profile, .bashrc, .bash_udit and .bash_logout files in your home directory to their original state, type from the login node:

    cp /opt/shared/templates/homedir/.bash* $HOME
Where to put startup commands: You can put bash commands in either ~/.bashrc or ~/.bash_profile. Again we do not recommend modifying these files unless you really know what you are doing. Here are general suggestions:
  • Even if you have favorite commands from other systems, start by using the supplied files and only modify .bash_udit for customization.
  • Add essential commands that you fully understand, and keep it simple. Quoting rules can be complicated.
  • Do not depend on the order of command execution. Do not assume your environment, set in .bash_profile, will be available when the commands in .bashrc are executed.
  • Do not include commands that spawn new shells, such as workgroup.
  • Be very careful of commands that may produce output. If you must, only execute them after a test to make sure there is a terminal to receive the output. Keep in mind using any commands that produce output may break other applications like file transfer (sftp, scp, WinSCP).
  • Do not include VALET commands as they produce output and will be a part of every job submitted which could cause conflicts with other applications you are trying to run in your job script.
  • Keep a session open on the cluster, so when you make a change that prevents you from logging on you can reverse the last change, or copy the original files from /opt/shared/templates/homedir/ to start over.

Using workgroup and directories

There are some key environment variables that are set for you, and are important for your work on any cluster. They are used to find directories for your projects. These environment variables are set on initial connection to a cluster, and will be changed if you

Connecting to login node

The system's initialization scripts set the values of some environment variables to help use the filesystems.

Variable Value Description
HOSTNAME «hostname» Host name
USER «login_name» Login name
HOME /home/«uid» Your home directory
The initialization scripts also set the standard prompt with your login name and a shortened host name. For example, if your «hostname» is darwin.hpc.udel.edu and your «login_name» is traine, then the standard prompt will be

[traine@login00.darwin ~]$

Clusters may be configured to have multiple login nodes, with one common name for connecting. For example, on the DARWIN cluster, the hostname may be set to login00 or login01, and the standard prompt and window title bar will indicate which login node on darwin.

Setting workgroup

To use the compute node resources for a particular allocation group (workgroup), you need to use the workgroup command.

For example,

    workgroup –g it_css

starts a new shell for the workgroup it_css, and sets the environment variables:

Variable Example Value Description
WORKDIR /lustre/it_css Allocation workgroup directory, this is not writeable
WORKGROUP it_css Current allocation workgroup name
WORKDIR_USER /lustre/it_css/users/«uid» Allocation workgroup user directory
WORKDIR_SW /lustre/it_css/sw Allocation workgroup software directory
Use specific environment variables such as $WORKDIR_USERS when referring to your allocation workgroup user directory and $WORKDIR_SW when referring to your allocation workgroup software directory. This will improve portability.
It is always important to be aware of your current allocation workgroup name. The standard prompt includes the allocation workgroup name, added to your username and host. You must have an allocation workgroup name in your prompt to use that allocation group's compute node resources to submit jobs using sbatch or salloc. An example prompt after the workgroup command,

[(it_css:traine)@login01.darwin ~]$

Changing directory

When you first connect to the login node, all your commands are executed from your home directory (~). Most of your work will be done in your allocation workgroup directory. The workgroup command has an option to start you in the allocation workgroup work directory. For example,

    workgroup -cg it_css

will spawn a new shell in the workgroup directory for it_css.

You can always use the cd bash command.

For example,

    cd users/1201/project/fuelcell
    cd /lustre/it_css/users/1201/project/fuelcell
    cd $WORKDIR/users/1201/project/fuelcell
    cd $WORKDIR_USERS/project/fuelcell

The first is using a path name relative to the current working directory (implied ./). The second, third and fourth use the full path ($WORKDIR and $WORKDIR_USERS always begins with a /). In all cases the directory is changed, and the $PWD environment variable is set:

Variable Example Value Description
PWD /lustre/it_css/users/1201/project/fuelcell Print (current) working directory
It is always important to be aware of your current working directory. The standard prompt ends with the basename of PWD. In these two examples the basename is the same, 1201, but the standard bash PROMPT_COMMAND, which is executed every time you change directories, will put the full path of your current working directory in your window title. For example,

traine@login00.darwin:/lustre/it_css/users/1201

Connecting to a compute node

To run a job on the compute nodes, you must submit your job script using sbatch or start an interactive session using salloc. In both cases, you will be connected to one of your allocation compute nodes based on the partition (queue) specified with a clean environment. Do not rely on the environment you set on the login node. The variables USER, HOME, WORKGROUP, WORKDIR, WORKDIR_USERS and PWD are all set on the compute node to match the ones you had on the login node, but two variables are set to node-specific values:

Variable Example Value Description
HOSTNAME r00n17 Compute node name
TMPDIR /tmp Temporary disk space

An empty directory is created by the SLURM job scheduler that is associated with your job and defined as TMPDIR. This is a safe place to store temporary files that will not interfere with other jobs and tasks you or other members of your group may be executing. This directory is automatically emptied on normal termination of your job. This way the usage on the node scratch filesystem will not grow over time.

Before submitting jobs you must first use the workgroup command. Type workgroup -h for additional information. Both sbatch and salloc will start in the same project directory you set on the login node and will require a single partition to be specified to be able to submit a batch or interactive session.

This section uses the wiki's documentation conventions.

Using VALET and your UNIX environment

The UD-developed VALET system facilitates your use of compilers, libraries, programming tools and application software. It provides a uniform mechanism for setting up a package's required UNIX environment. VALET is a recursive acronym for VALET Automates Linux Environment Tasks. It provides functionality similar to the Modules package used at other HPC sites.

VALET commands set the basic environment for software. This may include the PATH, MANPATH, INFOPATH, LDPATH, LIBPATH and LD_LIBRARY_PATH environment variables, compiler flags, software directory locations, and license paths. This reduces the need for you to set them or update them yourself when changes are made to system and application software. For example, you might find several versions for a single package name, such as Mathematica/8 and Mathematica/8.0.4. You can even apply VALET commands to packages that you install or alter its actions by customizing VALET's configuration files. Type man valet for instructions or see the VALET software documentation for complete details.

The table below shows the basic informational commands for VALET. In subsequent sections, VALET commands are illustrated in the contexts of application development (e.g., compiling, using libraries) and running IT-installed applications.

Command Function
vpkg_help VALET help.
vpkg_list List the packages that have VALET configuration files.
vpkg_versions «pkgid» List versions available for a single package.
vpkg_info «pkgid» Show information for a single package (or package version).
vpkg_require «pkgid» Configure environment for one or more VALET packages.
vpkg_devrequire «pkgid» Configure environment for one or more VALET packages including software development variables such as CPPFLAGS and LDFLAGS.
vpkg_rollback «# or all» Each time VALET changes the environment, it makes a snapshot of your environment to which it can return.
vpkg_rollback attempts to restore the UNIX environment to its previous state. You can specify a number (#) to revert one or more prior changes to the environment or all to remove all changes.
vpkg_history List the versioned packages that have been added to the environment.
man valet Complete documentation of VALET commands.