Lmod: Difference between revisions

From NU HPC Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
#firstHeading { background-color: #e6ffb4; }
{ background-color: #e6ffb4; }


In linux environment variables are values that can change and impact how programs behave on a computer system. They are name-value pairs that all processes can access within a particular user environment or shell session. These variables provide a flexible and convenient method for managing system-wide settings, configuring applications, and customizing system behavior.
In linux environment variables are values that can change and impact how programs behave on a computer system. They are name-value pairs that all processes can access within a particular user environment or shell session. These variables provide a flexible and convenient method for managing system-wide settings, configuring applications, and customizing system behavior.

Revision as of 05:34, 3 July 2024

{ background-color: #e6ffb4; }

In linux environment variables are values that can change and impact how programs behave on a computer system. They are name-value pairs that all processes can access within a particular user environment or shell session. These variables provide a flexible and convenient method for managing system-wide settings, configuring applications, and customizing system behavior.

Shabyt uses Environment modules (also know as Lmod) to dynamically set up environment variables for different software. Module commands set, change, or delete environment variables that are needed for a particular software. The ‘module load‘ command will set PATH, LD_LIBRARY_PATH and other environment variables such that user may choose a desired version of applications or libraries more easily. More details can be found here.

Environment module commands
Command Description
module avail List of available software
module keyword [word] Search for available modules matching the keyword
module spider [word] Show the details of any modules matching the keyword
module whatis [module] Show the short description about module
module load [package1] [package2] Load the environment for the default version of the modulefile
module load [package]/[version] Load the environment for the specified version of module
module unload [package1] [package2] Unload previously loaded packages
module swap [moduleA] [moduleB] Unload modulefile A and load modulefile B
module list List any currently loaded module(s)
module purge Unload all currently loaded modules

Using module avail

To see what modules you can load into your environment, enter the command module avail.

[hpcadmin@ln01 ~]$ module avail

----------------------------------------------------------------------------- /shared/opt/easybuild/modules/all -----------------------------------------------------------------------------
   AMD-uProf/3.5.671                                       PLUMED/2.7.3-foss-2021b                                          help2man/1.49.3-GCCcore-12.3.0
   AOCC/4.0.0-GCCcore-12.2.0                               PMIx/3.1.5-GCCcore-9.3.0                                         help2man/1.49.3-GCCcore-13.2.0          (D)
   ATK/2.38.0-GCCcore-11.3.0                               PMIx/3.2.3-GCCcore-10.3.0                                        hwloc/2.2.0-GCCcore-9.3.0
   Anaconda3/2022.05                                       PMIx/4.1.0-GCCcore-11.2.0                                        hwloc/2.2.0-GCCcore-10.2.0
   Autoconf/2.69-GCCcore-9.3.0                             PMIx/4.1.2-GCCcore-11.3.0                                        hwloc/2.4.1-GCCcore-10.3.0
   Autoconf/2.69-GCCcore-10.2.0                            PMIx/4.2.2-GCCcore-12.2.0                                        hwloc/2.5.0-GCCcore-11.2.0
   Autoconf/2.71-GCCcore-10.3.0                            PMIx/4.2.6-GCCcore-13.2.0                               (L,D)    hwloc/2.7.1-GCCcore-11.3.0
   Autoconf/2.71-GCCcore-11.2.0                            PROJ/8.0.1-GCCcore-10.3.0                                        hwloc/2.8.0-GCCcore-12.2.0
   Autoconf/2.71-GCCcore-11.3.0                            PROJ/9.0.0-GCCcore-11.3.0                               (D)      hwloc/2.9.2-GCCcore-13.2.0              (L,D)
   Autoconf/2.71-GCCcore-12.2.0                            Pango/1.48.5-GCCcore-10.3.0                                      hypothesis/6.13.1-GCCcore-10.3.0
   Autoconf/2.71-GCCcore-12.3.0                            Pango/1.48.8-GCCcore-11.2.0                                      hypothesis/6.14.6-GCCcore-11.2.0
   Autoconf/2.71-GCCcore-13.2.0                   (D)      Pango/1.50.7-GCCcore-11.3.0                             (D)      hypothesis/6.46.7-GCCcore-11.3.0        (D)

To unload all your loaded modules, enter the command module purge. Then module listwill return No modules loaded.

Using module spider

If you know the name of a software package, you can use the module spidercommand to find out if it is available and how to load it.

For example, to search for Python modules:

[hpcadmin@ln01 ~]$ module spider python

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Python:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Description:
      Python is a programming language that lets you work more quickly and integrate your systems more effectively.

     Versions:
        Python/2.7.18-GCCcore-11.3.0-bare
        Python/3.8.6-GCCcore-10.2.0
        Python/3.9.5-GCCcore-10.3.0-bare
        Python/3.9.5-GCCcore-10.3.0
        Python/3.9.6-GCCcore-11.2.0-bare
        Python/3.9.6-GCCcore-11.2.0
        Python/3.10.4-GCCcore-11.3.0-bare
        Python/3.10.4-GCCcore-11.3.0
        Python/3.11.3-GCCcore-12.3.0
        Python/3.11.5-GCCcore-13.2.0

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  For detailed information about a specific "Python" package (including how to load the modules) use the module's full name.
  Note that names that have a trailing (E) are extensions provided by other modules.
  For example:

     $ module spider Python/3.11.5-GCCcore-13.2.0
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


This shows that there are multiple versions of Python available. For more specific information, add the version to your command as given in the example:

[hpcadmin@ln01 ~]$ module spider Python/3.11.5-GCCcore-13.2.0

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Python: Python/3.11.5-GCCcore-13.2.0
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Description:
      Python is a programming language that lets you work more quickly and integrate your systems more effectively.


    This module can be loaded directly: module load Python/3.11.5-GCCcore-13.2.0

    Help:

      Description
      ===========
      Python is a programming language that lets you work more quickly and integrate your systems
       more effectively.


      More information
      ================
       - Homepage: https://python.org/


      Included extensions
      ===================
      flit_core-3.9.0, packaging-23.2, pip-23.2.1, setuptools-68.2.2, setuptools-
      scm-8.0.4, tomli-2.0.1, typing_extensions-4.8.0, wheel-0.41.2

Using module keyword

If you do not know the exact name of a software package, you can use the module keywordcommand instead to search for modules.

[hpcadmin@ln01 ~]$ module keyword python
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The following modules match your search criteria: "python"
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  Anaconda3: Anaconda3/2022.05
    Built to complement the rich, open source Python community, the Anaconda platform provides an enterprise-ready data analytics platform that empowers companies to adopt a modern
    open data science analytics architecture.


  Python: Python/2.7.18-GCCcore-11.3.0-bare, Python/3.8.6-GCCcore-10.2.0, Python/3.9.5-GCCcore-10.3.0-bare, Python/3.9.5-GCCcore-10.3.0, Python/3.9.6-GCCcore-11.2.0-bare, ...
    Python is a programming language that lets you work more quickly and integrate your systems more effectively.

Loading and unloading software

Typically, loading modules is as simple as entering module load <software_name>. The <software_name>must be visible when you run module avail.

By entering:

module load <software_name>

Lmod will set your environment such that the software specified in <software_name>will be placed in your PATH, and then you can run the commands associated with <software_name>.

If there are multiple versions of <software_name>, you can specify a version:

module load <software_name>/<version>

For example, to load gccversion 13.2.0, enter:

module load gcc/13.2.0

If no version is specified, then the default version will be loaded. The default version is indicated with a (D)next to it after running module avail.:

module load gcc

To unload a specific module, enter:

module unload <software_name>

To see the modules that you currently have loaded, enter:

module list