Skip to main content


Modules is a tool used to connect to different software packages to run your script. The module package provides for the dynamic modification of a user's Linux environment by loading and unloading modulefiles to modify environment variables. This allows users flexibility in switching versions of a specific software package quickly and easily using the module commands. These commands can be used when compiling or running a program. Below is a list of the common module commands.


Command Description
module avail lists all available modules
module avail <software package> shows all available versions of a specific software package
module display <module> shows all the commands executed by specified module
module load <module> loads a software module
module unload <module> unloads a software module
module switch <module 1> <module 2> unloads module 1 and loads module 2 
module list Shows all currently loaded modules


Modules Example

If you are to compile a C program written with mpi using the compiler mpicc. To see what implementations of mpi are available use the command $ module avail

text inside terminal 

We can see here that we have mpich, mvapich2, and openmpi as our options under the /cm/shared/modulefiles directory. To use the mpich modulefile implementation, you will need to load the modulefile into your environment.

First, we examine the module using $ module display to see all the commands executed by mpich. Next, we will add modulefile to our environment using $ module load then the modulefile of choice. 

text inside terminal

When you have loaded the module, use the command $ module list to see that mpich v 3.3.2 is loaded and ready to use. You can also use the command $ which mpicc to see the full path of the modulefile location.

What if you realized that the openmpi compiler would be a better option instead of mpich compiler? You can have multiple modules loaded at one time. You can easily change the implementation of the modules by using the command $ module switch. NOTE: As long as the modules are loaded in to the environment, you can switch freely between using the command. 

text inside terminal


Remember that when loading multiple versions of the same compiler, the module loaded last will always have precedence. Using the switch command will change the default modulefile. Always unload your modules when they are no longer needed.

<< SLURMPython >>