Actions

Load modules

From ALICE Documentation

Revision as of 08:57, 2 September 2020 by Schulzrf (talk | contribs) (Load modules)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Load modules

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

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

  [me@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/me/.local/bin:/home/me/bin)


We can load the python3 command with module load:

  [me@nodelogin01 ~]$ module load Python/3.7.2-GCCcore-8.2.0
  [me@nodelogin01 ~]$ which python3
  /cm/shared/easybuild/software/Python/3.7.4-GCCcore-8.3.0/bin/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.

  [me@nodelogin01 ~]$ echo $PATH
  /cm/shared/easybuild/software/Python/3.7.2-GCCcore-8.2.0/bin:/cm/shared/easybuild/software/XZ/5.2.4-GCCcore-  8.2.0/bin:/cm/shared/easybuild/software/SQLite/3.27.2-GCCcore-8.2.0/bin:/cm/shared/easybuild/software/Tcl/8.6.9-GCCcore-8.2.0/bin:/cm/shared/easybuild/software/libreadline/8.0-GCCcore-8.2.0/bin:/cm/shared/easybuild/software/ncurses/6.1-GCCcore-8.2.0/bin:/cm/shared/easybuild/software/bzip2/1.0.6- GCCcore-8.2.0/bin:/cm/shared/easybuild/software/GCCcore/8.2.0/bin:/cm/shared/apps/slurm/19.05.1/sbin:/cm/shared/apps/slurm/19.05.1/bin:/cm/local/apps/gcc/8.2.0/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/me/.local/bin:/home/me/bin

You will 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 us examine what is there:

   [me@nodelogin01 ~]$ ls /cm/shared/easybuild/software/Python/3.7.2-GCCcore-8.2.0/bin
   2to3		  futurize	 pip	      pytest		 python3-config  rst2odt_prepstyles.py	sphinx-apidoc
   2to3-3.7	  idle3		 pip3	      py.test		 pyvenv		 rst2odt.py		sphinx-autogen
   chardetect	  idle3.7	 pip3.7       python		 pyvenv-3.7	 rst2pseudoxml.py	sphinx-build
   cygdb	  netaddr	 pybabel      python3		 rst2html4.py	 rst2s5.py		sphinx-quickstart
   cython	  nosetests	 __pycache__  python3.7		 rst2html5.py	 rst2xetex.py		tabulate
   cythonize	  nosetests-3.7  pydoc3       python3.7-config	 rst2html.py	 rst2xml.py		virtualenv
   easy_install	  pasteurize	 pydoc3.7     python3.7m	 rst2latex.py	 rstpep2html.py		wheel
   easy_install-3.7  pbr	 pygmentize   python3.7m-config  rst2man.py	 runxlrd.py


Taking this to its conclusion, module load adds software to your $PATH. It “loads” software.

A special note on this, module load will also load required software dependencies. If you compare the output below with what you had when you first logged in to ALICE, you will notice several other modules have been load automatically, because the Python module depends on them.

   [me@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/19.05.1    8) ncurses/6.1-GCCcore-8.2.0  12) XZ/5.2.4-GCCcore-8.2.0

Also a note of warning: When you load several modules, it is possible that their dependencies can cause conflicts and problems later on. It is best to always check what other modules have been automatically loaded.