Accessing software

From ALICE Documentation

Revision as of 21:22, 8 July 2019 by Kosterj1 (talk | contribs)

Before we start using individual software packages, we need to understand why multiple versions of software are available on HPC systems and why users need to have a way to control which version they are using. The three biggest factors are:

  • software incompatibilities;
  • versioning;
  • dependencies.

Software incompatibility is a major headache for programmers. Sometimes the presence (or absence) of a software package will break others that depend on it. Two of the most famous examples are Python 2 and 3 and C compiler versions. Python 3 famously provides a python command that conflicts with that provided by Python 2. Software compiled against a newer version of the C libraries and then used when they are not present will result in a nasty 'GLIBCXX_3.4.20' not found error, for instance.

Software versioning is another common issue. A team might depend on a certain package version for their research project - if the software version was to change (for instance, if a package was updated), it might affect their results. Having access to multiple software versions allow a set of researchers to prevent software versioning issues from affecting their results.

Dependencies are where a particular software package (or even a particular version) depends on having access to another software package (or even a particular version of another software package). For example, the VASP materials science software may depend on having a particular version of the FFTW (Fastest Fourier Transform in the West) software library available for it to work.

Environment modules

Environment modules are the solution to these problems. A module is a self-contained description of a software package - it contains the settings required to run a software package and, usually, encodes required dependencies on other software packages.

There are a number of different environment module implementations commonly used on HPC systems: the two most common are TCL modules and Lmod. Both of these use similar syntax and the concepts are the same so learning to use one will allow you to use whichever is installed on the system you are using. In both implementations the module command is used to interact with environment modules. An additional subcommand is usually added to the command to specify what you want to do. For a list of subcommnands you can use module -h or module help. As for all commands, you can access the full help on the man pages with man module.

On login you may start out with a default set of modules loaded or you may start out with an empty environment, this depends on the setup of the system you are using.

Listing currently loaded modules

You can use the module list command to see which modules you currently have loaded in your environment. If you have no modules loaded, you will see a message telling you so

[remote]$ module list
No Modulefiles Currently Loaded.

Listing available modules

To see available modules, use module avail

[deuler@nodelogin01 ~]$ module avail
  ------------------------------------------------ /cm/shared/easybuild/modules/all -------------------------------------------------
  Autoconf/2.69-GCCcore-6.4.0                            binutils/2.31.1-GCCcore-8.2.0
  Autoconf/2.69-GCCcore-8.2.0                     (D)    binutils/2.31.1                           (D)
  Automake/1.15.1-GCCcore-6.4.0                          bzip2/1.0.6-GCCcore-6.4.0
  Automake/1.16.1-GCCcore-8.2.0                   (D)    bzip2/1.0.6-GCCcore-8.2.0                 (D)
  Autotools/20170619-GCCcore-6.4.0                       expat/2.2.5-GCCcore-6.4.0
  Autotools/20180311-GCCcore-8.2.0                (D)    flex/2.6.3
  Bison/3.0.4-GCCcore-6.4.0                              flex/2.6.4-GCCcore-6.4.0
  Bison/3.0.4                                            flex/2.6.4-GCCcore-8.2.0
  Bison/3.0.5-GCCcore-6.4.0                              flex/2.6.4                                (D)
  Bison/3.0.5-GCCcore-8.2.0                              fontconfig/2.12.6-GCCcore-6.4.0
  Bison/3.0.5                                     (D)    foss/2018a
  Docutils/0.9.1-foss-2018a-Python-2.7.14                foss/2019a                                (D)
  EasyBuild/3.9.2                                        freetype/2.9-GCCcore-6.4.0
  FFTW/3.3.7-gompi-2018a                                 gettext/
  FFTW/3.3.8-gompi-2019a                          (D)    gettext/                          (D)
  GCC/6.4.0-2.28                                         gompi/2018a
  GCC/8.2.0-2.31.1                                (D)    gompi/2019a                               (D)
  GCCcore/6.4.0                                          gperf/3.1-GCCcore-6.4.0
  GCCcore/8.2.0                                   (D)    h5py/2.7.1-foss-2018a-Python-2.7.14
  GMP/6.1.2-GCCcore-6.4.0                                help2man/1.47.4-GCCcore-6.4.0
  GMP/6.1.2-GCCcore-8.2.0                         (D)    help2man/1.47.4
  GSL/2.4-GCCcore-6.4.0                                  help2man/1.47.7-GCCcore-8.2.0             (D)
  HDF5/1.8.20-foss-2018a                                 hwloc/1.11.8-GCCcore-6.4.0
  HDF5/1.10.1-foss-2018a                          (D)    hwloc/1.11.11-GCCcore-8.2.0               (D)
  M4/1.4.17                                              intltool/0.51.0-GCCcore-6.4.0-Perl-5.26.1
  M4/1.4.18-GCCcore-6.4.0                                libffi/3.2.1-GCCcore-6.4.0
  M4/1.4.18-GCCcore-8.2.0                                libffi/3.2.1-GCCcore-8.2.0                (D)
  M4/1.4.18                                       (D)    libpciaccess/0.14-GCCcore-6.4.0
  MPFR/4.0.1-GCCcore-6.4.0                               libpciaccess/0.14-GCCcore-8.2.0           (D)
  OpenBLAS/0.2.20-GCC-6.4.0-2.28                         libpng/1.6.34-GCCcore-6.4.0
  OpenBLAS/0.3.5-GCC-8.2.0-2.31.1                 (D)    libreadline/7.0-GCCcore-6.4.0
  OpenMPI/2.1.2-GCC-6.4.0-2.28                           libreadline/8.0-GCCcore-8.2.0             (D)
  OpenMPI/3.1.3-GCC-8.2.0-2.31.1                  (D)    libtool/2.4.6-GCCcore-6.4.0
  Perl/5.26.1-GCCcore-6.4.0                              libtool/2.4.6-GCCcore-8.2.0               (D)
  Python/2.7.14-foss-2018a                               libxml2/2.9.4-GCCcore-6.4.0
  Python/2.7.15-GCCcore-8.2.0                            libxml2/2.9.7-GCCcore-6.4.0
  Python/3.7.2-GCCcore-8.2.0                      (D)    libxml2/2.9.8-GCCcore-8.2.0               (D)
  SQLite/3.21.0-GCCcore-6.4.0                            matplotlib/2.1.2-foss-2018a-Python-2.7.14
  SQLite/3.27.2-GCCcore-8.2.0                     (D)    mpi4py/3.0.0-foss-2018a-Python-2.7.14
  ScaLAPACK/2.0.2-gompi-2018a-OpenBLAS-0.2.20            ncurses/6.0-GCCcore-6.4.0
  ScaLAPACK/2.0.2-gompi-2019a-OpenBLAS-0.3.5      (D)    ncurses/6.0
  SciPy-bundle/2019.03-foss-2019a                        ncurses/6.1-GCCcore-8.2.0                 (D)
  Szip/2.1.1-GCCcore-6.4.0                               numactl/2.0.11-GCCcore-6.4.0
  Tcl/8.6.8-GCCcore-6.4.0                                numactl/2.0.12-GCCcore-8.2.0              (D)
  Tcl/8.6.9-GCCcore-8.2.0                         (D)    pip/19.1.1-foss-2018a-Python-2.7.14
  Tk/8.6.8-foss-2018a                                    pkg-config/0.29.2-GCCcore-6.4.0
  Tkinter/2.7.14-foss-2018a-Python-2.7.14                pkgconfig/1.3.1-foss-2018a-Python-2.7.14
  X11/20180131-GCCcore-6.4.0                             scikit-learn/0.20.3-foss-2019a
  XML-Parser/2.44_01-GCCcore-6.4.0-Perl-5.26.1           wheel/0.32.0-foss-2018a-Python-2.7.14
  XZ/5.2.3-GCCcore-6.4.0                                 xorg-macros/1.19.1-GCCcore-6.4.0
  XZ/5.2.4-GCCcore-8.2.0                          (D)    xorg-macros/1.19.2-GCCcore-8.2.0          (D)
  amuse-framework/12.0.0-foss-2018a-Python-2.7.14        zlib/1.2.11-GCCcore-6.4.0
  amuse/12.0.0-foss-2018a-Python-2.7.14                  zlib/1.2.11-GCCcore-8.2.0
  binutils/2.28-GCCcore-6.4.0                            zlib/1.2.11                               (D)
  ------------------------------------------------------ /cm/local/modulefiles ------------------------------------------------------
  cluster-tools/8.2    cmd      dot               gcc/8.2.0       (L)    lua/5.3.5     module-info    openldap    python36
  cm-cloud-copy/8.2    cmsub    freeipmi/1.6.2    ipmitool/1.8.18        module-git    null           python2     shared   (L)
  ----------------------------------------------------- /usr/share/modulefiles ------------------------------------------------------
  DefaultModules (L)
  ----------------------------------------------------- /cm/shared/modulefiles ------------------------------------------------------
  blacs/openmpi/gcc/64/1.1patch03      globalarrays/openmpi/gcc/64/5.7           mvapich2/gcc/64/2.3
  blas/gcc/64/3.8.0                    hdf5/1.10.1                               netcdf/gcc/64/4.6.1
  bonnie++/1.97.3                      hdf5_18/1.8.20                            netperf/2.7.0
  cm-pmix3/3.0.2                       hpl/2.2                                   openblas/dynamic/0.2.20
  default-environment                  hwloc/1.11.11                             openmpi/gcc/64/1.10.7
  fftw2/openmpi/gcc/64/double/2.1.5    intel-tbb-oss/ia32/2019_20180718oss       scalapack/openmpi/gcc/64/2.0.2
  fftw2/openmpi/gcc/64/float/2.1.5     intel-tbb-oss/intel64/2019_20180718oss    sge/2011.11p1
  fftw3/openmpi/gcc/64/3.3.8           iozone/3_482                              slurm/18.08.4                  (L)
  gcc6/6.5.0                           lapack/gcc/64/3.8.0
  gdb/8.2                              mpich/ge/gcc/64/3.3
  L:  Module is loaded
  D:  Default Module
 Module defaults are chosen based on Find First Rules due to Name/Version/Version modules found in the module tree.
 See for details.
 Use "module spider" to find all possible modules.
 Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys"

Loading and unloading modules

To load a software module, use module load. In this example we will use Python 3.

Initially, Python 3 is not loaded. We can test this by using the which command. which looks for programs the same way that Bash does, so we can use it to tell us where a particular piece of software is stored.

[deuler@nodelogin01 ~]$ which python3
/usr/bin/which: no python3 in (/cm/shared/apps/slurm/18.08.4/sbin:/cm/shared/apps/slurm/18.08.4/bin:/cm/local/apps/gcc/8.2.0/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/deuler/.local/bin:/home/deuler/bin)

We can load the python3 command with module load:

[deuler@nodelogin01 ~]$ module load Python/3.7.2-GCCcore-8.2.0
[deuler@nodelogin01 ~]$ which python3

So what just happened?

To understand the output, first we need to understand the nature of the $PATH environment variable. $PATH is a special environment variable that controls where a Linux operating system (OS) looks for software. Specifically $PATH is a list of directories (separated by :) that the OS searches through for a command. As with all environment variables, we can print it using echo.

[remote]$ echo $PATH

You’ll notice a similarity to the output of the which command. In this case, there’s only one difference: the /cm/shared/easybuild/software/Python/3.7.2-GCCcore-8.2.0/bin directory at the beginning. When we used module load Python/3.7.2-GCCcore-8.2.0, it added this directory to the beginning of our $PATH. Let’s examine what is there:

 [deuler@nodelogin01 ~]$ \ls /cm/shared/easybuild/software/Python/3.7.2-GCCcore-8.2.0/bin
 2to3		  futurize	 pip	      pytest		 python3-config	sphinx-apidoc
 2to3-3.7	  idle3		 pip3	      py.test		 pyvenv		sphinx-autogen
 chardetect	  idle3.7	 pip3.7       python		 pyvenv-3.7	sphinx-build
 cygdb		  netaddr	 pybabel      python3		sphinx-quickstart
 cython		  nosetests	 __pycache__  python3.7		tabulate
 cythonize	  nosetests-3.7  pydoc3       python3.7-config		virtualenv
 easy_install	  pasteurize	 pydoc3.7     python3.7m		wheel
 easy_install-3.7  pbr		 pygmentize   python3.7m-config

Taking this to its conclusion, module load adds software to your $PATH. It “loads” software. A special note on this - depending on which version of the module program that is installed at your site, module load may also load required software dependencies.

 [deuler@nodelogin01 ~]$ module list
 Currently Loaded Modules:
   1) shared           5) GCCcore/8.2.0               9) libreadline/8.0-GCCcore-8.2.0  13) GMP/6.1.2-GCCcore-8.2.0
   2) DefaultModules   6) bzip2/1.0.6-GCCcore-8.2.0  10) Tcl/8.6.9-GCCcore-8.2.0        14) libffi/3.2.1-GCCcore-8.2.0
   3) gcc/8.2.0        7) zlib/1.2.11-GCCcore-8.2.0  11) SQLite/3.27.2-GCCcore-8.2.0    15) Python/3.7.2-GCCcore-8.2.0
   4) slurm/18.08.4    8) ncurses/6.1-GCCcore-8.2.0  12) XZ/5.2.4-GCCcore-8.2.0

So module load loads a specific module. Let's unload the main package.

 [deuler@nodelogin01 ~]$ module unload Python/3.7.2-GCCcore-8.2.0
 [deuler@nodelogin01 ~]$ module list
 Currently Loaded Modules:
   1) shared           5) GCCcore/8.2.0               9) libreadline/8.0-GCCcore-8.2.0  13) GMP/6.1.2-GCCcore-8.2.0
   2) DefaultModules   6) bzip2/1.0.6-GCCcore-8.2.0  10) Tcl/8.6.9-GCCcore-8.2.0        14) libffi/3.2.1-GCCcore-8.2.0
   3) gcc/8.2.0        7) zlib/1.2.11-GCCcore-8.2.0  11) SQLite/3.27.2-GCCcore-8.2.0
   4) slurm/18.08.4    8) ncurses/6.1-GCCcore-8.2.0  12) XZ/5.2.4-GCCcore-8.2.0

So using module unload “un-loads” a module along with its dependencies. Use module purge to unload everything at once.

 [deuler@nodelogin01 ~]$ module purge
 [deuler@nodelogin01 ~]$ module list
 No modules loaded