Skip to main content

Table of Contents

Introduction

Initialization

More Module Commands

Introduction

For the Longleaf and Dogwood clusters we have implemented “modules” utility to manage the user environment for different software versions. The distinct advantage of the modules approach is that the user is no longer required to explicitly specify paths for different executable versions nor need to try to keep the PATH, LD_LIBRARY_PATH, MANPATH and related environment variables coordinated. With the modules approach, users simply “add” and “rm” modules to control their environment.

Modules provide an easy mechanism for updating a user’s environment especially the PATH, MANPATH, and LD_LIBRARY_PATH, etc. environment variables to name a few.

Initialization

You can use the commands below to modify your environment and to control what modules are loaded whenever you log in:

  $ module add modulefile 
  $ module list 
  $ module rm modulefile

where “modulefile” is the name of the module you want loaded.

Use the “save” command to save your module environment and have a module automatically loaded each time you log into the system:

  $ module save 

To have the module loaded only for your current session you can do:

  $ module add modulefile
   or
  $ module load modulefile

The following command will unload a module from your current session.  To remove any listed modules from your current environment you can use the “module rm” or “module unload” command:

  $ module list
  $ module rm modulefile
   or
  $ module unload modulefile

More Module Commands

To get a usage list of module options type the following (the listing has been abbreviated to only those commands discussed in this webpage):

  $ module help
   Usage: module [options] sub-command [args ...]
   Available SubCommands and Args:
   + add|load module [module...]
   + rm|unload module [module...]
   + display|show modulefile [module...]
   + avail [module [module...]]
   + list
   + help 
   + spider

list

The “module list” command will list all the modules which are currently loaded in your environment:

  $ module list

avail

And the “module avail” command lists all the modules available to be loaded

  $ module avail
    or
  $ module spider

help

To get more information about a specific module use the module help command to display the “help” information contained within the given module file.

  $ module help gromacs
  ------- Module Specific Help for "gromacs/2016.3" --------
   gromacs/2016.3 module
        ****************************************************

          This module sets up the following environment
          variables for Gaussian
              GMXPREFIX
              GMXBIN
              GMXLDLIB
              GMXMAN
              GMXDATA
              GROMACS_DIR
              PATH
              LD_LIBRARY_PATH
              PKG_CONFIG_PATH
              MANPATH

show

The “module show” command allows you to see exactly what a given “modulefile” will do to your environment, such as what will be added to the PATH, MANPATH, etc. environment variables:

  $ module show gromacs
------------------------------------------------------------
   /nas/longleaf/apps/lmod/modulefiles/Core/gromacs/2016.3.lua:
------------------------------------------------------------
whatis("Set up environment for Gromacs 2016.3")
conflict("gromacs")
setenv("GMXPREFIX","/nas/longleaf/apps/gromacs/2016.3")
setenv("GMXBIN","/nas/longleaf/apps/gromacs/2016.3/bin")
setenv("GMXLDLIB","/nas/longleaf/apps/gromacs/2016.3/lib64")
setenv("GMXMAN","/nas/longleaf/apps/gromacs/2016.3/share/man")
setenv("GMXDATA","/nas/longleaf/apps/gromacs/2016.3/share/gromacs")
setenv("GROMACS_DIR","/nas/longleaf/apps/gromacs/2016.3")
setenv("GMX_FONT","10x20")
prepend_path("PATH","/nas/longleaf/apps/gromacs/2016.3/bin")
prepend_path("LD_LIBRARY_PATH","/nas/longleaf/apps/gromacs/2016.3/lib64")
prepend_path("PKG_CONFIG_PATH","/nas/longleaf/apps/gromacs/2016.3/lib64/pkgconfig")
prepend_path("MANPATH","/nas/longleaf/apps/gromacs/2016.3/share/man")
help([[        gromacs/2016.3 module
        ****************************************************

          This module sets up the following environment
          variables for Gaussian
              GMXPREFIX
              GMXBIN
              GMXLDLIB
              GMXMAN
              GMXDATA
              GROMACS_DIR
              PATH
              LD_LIBRARY_PATH
              PKG_CONFIG_PATH
              MANPATH

add

The following command adds one or more modulefiles to your current environment. If you load a module name without the version infomation, you will get the default version (D). Modules load silently without a confirmation message unless there is a problem with a modulefile. If there is problem, please notify us via email research@unc.edu with the research cluster name (e.g. longleaf) and a screen shot or copy’n’paste of the error/issue.

  $ module add modulefile 

At times one module will conflict with another. In that event you will receive an error and will need to remove the conflicting module yourself before being able to proceed. To load a specific version, load the module using its full specification. An example showing this follows:

  $ module add gaussian/09e01
  $ module add gaussian/16a03

The following have been reloaded with a version change:
  1) gaussian/09e01 => gaussian/16a03
  $ module rm gaussian/09e01
  $ module list

Email research@unc.edu with any questions or feedback.