What are default modules?

Default modules are those modules loaded when you login. The mechanism used to create a set of default modules is called a module set. Module sets are given names, and one becomes the default when you name it default.

Pro and con of setting default modules

It’s easy to see the upside of default modules. They load without you having to do anything, they are available to all your sessions, they can provide you a consistent starting environment. If you do most of your work with the same set of modules loaded, you should consider creating a default set (how will be explained below). If you need modules loaded to use ARC Connect, having them in your default set is required at this time.

However, if you work in multiple environments, or if you build a lot of your own software, then having a default set of modules may not be as convenient. For example, if you work on writing software, or testing software by compiling it with several compiler and library combinations, then you would have to first unload the defaults to test any other combination. If you compile with a non-default module set, then it’s possible that the default set might interfere with running that build in a job.

Creating a default module set

To create a module set, it is best to start with a fresh login and a verifiably empty module list. We recommend that you log out of Flux, then log back in, and start by unloading all modules (even if there are none).

$ module purge

Once you clear all loaded modules by purging, load the modules you would like in your default set, in the correct order. For example, if you wanted to have the Intel compilers, Open MPI 1.10.2, and HDF5 as your default step, you would load them and confirm the list and order,

$ module load intel/16.0.3
$ openmpi/1.10.2/intel/16.0.3
$ hdf5/1.8.16/intel/16.0.3
$ module list

Currently Loaded Modules:
  1) intel/16.0.3                  3) hdf5/1.8.16/intel/16.0.3
  2) openmpi/1.10.2/intel/16.0.3

then you create the default set with

$ module save default
Saved current collection of modules to: default

To verify that this worked, log out, then log back in again, and use the module list command to verify that the right list got loaded.

Restoring modules to user's default
[bennet@flux-build2 ~]$ module list

Currently Loaded Modules:
  1) intel/16.0.3                  3) hdf5/1.8.16/intel/16.0.3
  2) openmpi/1.10.2/intel/16.0.3

If for some reason you need a different set, we strongly recommend that you use module purge to clear the list completely, then load the desired modules in the correct order starting from none loaded.

Please see our web page on Managing software with Lmod for more details on modules and sets that are not default.