Picking Modules

Lmod uses the directories listed in MODULEPATH to find the modulefiles to load.

MODULEPATH

MODULEPATH is an environment variable used by Lmod to locate module files. It is a colon-separated list of directories that contain module files.

When a user loads a module, Lmod searches for the module file in each directory listed in MODULEPATH.

Picking modules when there are multiple directories in MODULEPATH

When there are multiple directories specified in MODULEPATH, the rules get more complicated on what module file to load. Lmod uses the following rules to locate a module file:

  1. If the user specify the full name of a module, the exact module will load.

    As an example, suppose you have the following module tree:

    ---------- /home/user/modulefiles -----------
    abc/11.1  abc/11.2
    
    
    ---------- /opt/apps/modulefiles ------------
    abc/10.1
    
    ---------- /opt/apps/mfiles -----------------
    abc/12.0   abc/12.1 (D) abc/12.2

    If a user type:

    module load abc/10.1

    This will load abc/10.1 module.

  2. If the user didn’t specify the version (only the name). A marked default which will be loaded.

    For example, when a user type:

    module load abc

    This will load abc/12.1, because it’s marked as default.

  3. If the user specified part of the version, and none of it matches the default, then the module with highest version will be selected.

    For example:

    module load abc/11

    Then abc/11.2 will be loaded because it’s the highest of the abc/11.* modulefiles.

    This work doesn’t work is if a version matches is marked default. For example:

    module load abc/12

    Then abc/12.1 will load not abc/12.2 because 12.1 is the marked default

    For information how Lmod marks a version as default, see Lmod documentation