Cluster Usage
2.1 Login To The Cluster Environment
The login node is the node where the user logs in and works from. Simple clusters have a single login node, but large clusters sometimes have multiple login nodes to improve the availability of the cluster. In most clusters, the login node is also the head node from where the cluster is monitored and installed. On the login node:
-
applications can be developed
-
code can be compiled and debugged
-
applications can be submitted to the cluster for execution
-
running applications can be monitored
To carry out an ssh login to the cluster, a terminal session can be started from Unix-like operating systems:
Example
On a Windows operating system, an SSH client such as PuTTY (http://www.putty.org) can be downloaded. Another standard possibility is to run a Unix-like environment such as Cygwin (http://www.cygwin.com) within the Windows operating system, and then run the SSH client from within it.
A Mac OS X user can use the Terminal application from the Finder, or under Application/Utilities/Terminal.app. An X11 windowing environment must be installed for it to work. XQuartz is the recommended X11 windowing environment, and is indeed the only Apple-backed X11 version available from OS X 10.8 onward.
When using the SSH connection, the cluster’s address must be added. When the connection is made, a username and password must be entered at the prompt.
If the administrator has changed the default SSH port from 22 to something else, the port can be specified with the -p <port> option:
The -X option can be dropped if no X11-forwarding is required. X11-forwarding allows a GUI application from the cluster to be displayed locally.
Optionally, after logging in, the password used can be changed using the passwd command:
2.2 Setting Up The User Environment
By default, each user uses the bash shell interpreter. In that case, each time a user login takes place, a file named .bashrc is executed to set up the shell environment for the user. The shell and its environment can be customized to suit user preferences. For example,
-
the prompt can be changed to indicate the current username, host, and directory, for example: by setting the prompt string variable:
-
the size of the command history file can be increased, for example:
export HISTSIZE=100 -
aliases can be added for frequently used command sequences, for example:
alias lart='ls -alrt' -
environment variables can be created or modified, for example:
export MYVAR=MYSTRING -
the location of software packages and versions that are to be used by a user (the path to a package) can be set.
Because there is a huge choice of software packages and versions, it can be hard to set up the right environment variables and paths for software that is to be used. Collisions between different versions of the same package and non-matching dependencies on other packages must also be avoided. To make setting up the environment easier, BCM provides preconfigured environment modules (section 2.3).
2.3 Environment Modules
For a user to compile and run computational jobs on a cluster, a special shell environment is typically set up for the software that is used.
However, setting up the right environment for a particular software package and version can be tricky, and it can be hard to keep track of how it was set up.
For example, users want to have a clean way to bring up the right environment for compiling code according to the various MPI implementations, but can easily get confused about which libraries have been used, and can end up with multiple libraries with similar names installed in a disorganized manner.
A user might also like to conveniently test new versions of a software package before permanently installing the package.
Within a Linux distribution running without special utilities, setting up environments can be complex. However, BCM makes use of the environment modules package, which provides the module command. The module command is a special utility to make taking care of the shell environment much easier.
2.3.1 Available Commands
Practical use of the modules commands is given in sections 2.3.2 and 2.3.3.
For reference, the help text for the module command can be viewed as follows:
Example
2.3.2 Managing Environment Modules As A User
There is a good chance the cluster administrator has set up the user’s account, fred for example, so that some modules are loaded already by default. In that case, the modules loaded into the user’s environment can be seen with the module list command:
Example
If there are no modules loaded by default, then the module list command just returns nothing.
How does a user know what modules are available? The “module avail” command lists all modules that are available for loading (some output elided):
Example
In the list there are two kinds of modules:
-
local modules, which are specific to the node, or head node only
-
shared modules, which are made available from a shared storage, and which only become available for loading after the
sharedmodule is loaded.
Modules can be loaded using the add or load options. A list of modules can be added by spacing them:
Example
Tab completion works for suggesting modules for the add/load commands. If the tab completion suggestion is unique, even though it is not the full path, then it is still enough to specify the module. For example, looking at the possibile available modules listed by the avail command previously, it turns out that specifying gcc is enough to specify gcc/14.2.0 because there is no other directory path under gcc/ besides 14.2.0 anyway.
To remove one or more modules, the module unload or module rm command is used.
To remove all modules from the user’s environment, the module purge command is used.
The user should be aware that some loaded modules can conflict with others loaded at the same time. This can happen with MPI modules. For example, loading openmpi/gcc without removing an already loaded intel/mpi/64 can result in conflicts about which compiler should be used.
2.3.2.1 The shared Module
The shared module provides access to shared libraries. By default these are under /cm/shared.
The shared module is special because often other modules, as seen under /cm/shared/modulefiles, depend on it. So, if it is to be loaded, then it is usually loaded first, so that the dependent modules can use it.
The shared module is obviously a useful local module, and is therefore often configured to be loaded for the user by default. Setting the default environment modules is discussed in section 2.3.3.
2.3.3 Changing The Default Environment Modules
.
If a user has to manually load up the same modules every time upon login it would be inefficient. That is why an initial default state for modules can be set up by the user, by using the module init* subcommands:
The more useful ones of these are:
-
module initadd: add a module to the initial state -
module initrm: remove a module from the initial state -
module initlist: list all modules loaded initially -
module initclear: clear all modules from the list of modules loaded initially
Example
In the preceding example, the modules defined for the new initial environment for the user are loaded from the next login onward.
Example
If the user is unsure about what the module does, it can be checked using “module whatis”:
The man pages for module and modulefile give further details on usage.
2.4 Compiling Applications
Compiling an application is usually done on the head node or login node. Typically, there are several compilers available on the head node in BCM. These compilers provide different levels of optimization, standards conformance, and support for accelerators.
For example: The GNU compiler collection, Intel compilers, and the NVIDIA HPC SDK compilers. The following table summarizes the available compiler commands on a cluster with these compilers:
GNU compilers are the de facto standard on Linux and are installed by default. They are provided under the terms of the GNU General Public License. Compilers by NVIDIA HPC and Intel are available as packages via the BCM YUM repository, and require the purchase of a license to use them. To make a compiler available to be used in a user’s shell commands, the appropriate environment module (section 2.3) must be loaded first. On most clusters two versions of GCC are available:
-
The version of GCC that comes along with the Linux distribution. For example, for Ubuntu 24.04:
Example
-
The latest version suitable for general use that is packaged as a module by BCM:
Example
To use the latest version of GCC, the gcc module in a default BCM cluster must be loaded. To revert to the version of GCC that comes natively with the Linux distribution, the gcc module must be unloaded.
The compilers—GCC, Intel, NVIDIA HPC—in the preceding table are ordinarily used for applications that run on a single node. However, the applications used may fork, thread, and run across as many nodes and processors as they can access if the application is designed that way.
The standard, structured way of running applications in parallel is to use the MPI-based libraries (Chapter 3). These are the MPICH, MVAPIC, Open MPI, and Intel MPI libraries. The libraries link to the underlying compilers of the preceding table.
If the parallel library environment has been loaded, then the following MPI compiler commands automatically use the underlying compilers:
2.4.1 Open MPI And Mixing Compilers
BCM comes with multiple Open MPI packages corresponding to the different available compilers. However, sometimes mixing compilers is desirable. For example, C-compilation may be preferred using icc from Intel, while Fortran90-compilation may be preferred using gfortran from the GNU Project. In such cases it is possible to override the default compiler path environment variable, for example:
Variables that may be set are OMPI_CC, OMPI_CXX, OMPI_FC, and OMPI_F77. More on overriding the Open MPI wrapper settings is documented in the man pages of mpicc in the environment section.