Modules

Description

The modules software package allows you to dynamically modify your user environment by using “modulefiles.”

Each modulefile contains the information needed to configure the shell for an application. After the modules software package is initialized, the environment can be modified on a per-module basis using the module command, which interprets modulefiles. Typically, modulefiles instruct the module command to alter or set shell environment variables such as PATH, MANPATH, and others. The modulefiles can be shared by many users on a system, and users can have their own collection to supplement or replace the shared modulefiles.

As a user, you can add and remove modulefiles from the current environment. The environment changes contained in a modulefile can be summarized through the module command as well.

More information on modules can be found by running the following commands on NCCS systems:

  • man module
  • module
    1. Find the name of the HDF5 module.
       % module avail
        CC                  X11                 libsci
        CC.5.1.0.4          X11.6.6.0.1         libsci.5.1.0.1
        CC.5.1.0.5          X11.6.6.0.2         libsci.5.4.0.1
        hdf5-par            ncarg-1             netcdf-3
        hdf5-ser                                netcdf-5
       %
    2. Verify that the HDF5 module or another version of the module is not currently loaded. Loading multiple versions of the same module can have unpredictible results.
       % module list
         Currently Loaded Modulefiles:
        1) CC        4) thdf5-ser
        2) X11
        3) libsci
       %
    3. Help on a particular modulefile including usage can be obtained.
      % module help netcdf/3.6.2
      ----------- Module Specific Help for 'netcdf/3.6.2' ---------------
      Sets up environment to use netcdf 3.6.2.
      Usage:   ftn test.f90 ${NETCDF_FLIB}
          or   cc test.c ${NETCDF_CLIB}
      %
    4. If another version of the HDF5 module is loaded (as in the above example) it must first be unloaded, or it can simply be swapped for the needed module.
      % module swap hdf5-ser hdf5-par
      %
    5. If there is not a version of the needed module (hdf5-par) loaded, the module can simply be loaded.
      % module load hdf5-par
      %
    6. Verify the change.
       % module list
         Currently Loaded Modulefiles:
        1) CC        4) thdf5-par
        2) X11
        3) libsci
       %
  • Use

    Command Description
    module lists Lists modules currently loaded in a user’s environment. A module is considered loaded when its associated modulefile has been executed and the user’s environment contains the changes from the modulefile.
    module avail Lists all available modules on a system.
    module show Shows environment changes that will be made by loading a given module.
    module load Loads a module.
    module unload Unloads a module.
    module help Shows help for a module.
    module swap Swaps a currently loaded module for an unloaded module.