Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

Modules are the way Research Computing provides a lot of software without it all conflicting with each other. Modules are also the way we provide multiple versions of the same software.

NOTE: Sometimes module is not the best option for loading software. Instead, you may want to use spack load; we have a guide for when to use each.

Getting to Know Modules

After logging on to a computer managed by Research Computing you will be able to use the module command. module works by manipulating your environment to give you access to the software. The following is a list of subcommands for module that will allow to take full advantage of module. Note: [module] is the name of the module you want to load.

...

module avail  [module]

...

module whatis [module]

...

module load [module]

...

module unload [module]

...

module list

...

module help

...

module help [module]

...

module show [module]

...

A Demonstration of module

The following is a demonstration of the module commands to give you an idea of how the commands listed above behave. For this demonstration we will be trying to load the newest version of Python available on our system (3.7.2).

...

We will check to see if a version of module is already available

[abc1234@computer ~]$ python -V
Python 2.7.5

...

So now that we know that version currently loaded for Python is not version we want, we look to see if that version is available:

[abc1234@computer ~]$ module avail python
-------- /tools/spack/Modulefiles.tcl/linux-rhel7-x86_64 --------

python/2.7.16-gcc-7.4.0-2geicowv python/3.7.2--gcc-7.4.0-6on2qnpy

python/2.7.16-gcc-7.4.0-6yshniaz
------------------- /tools/Modules/modulefiles ------------------
python/2.7.10 python/2.7.12 python/2.7.9 python/3.5.2

Note: module avail would have worked just as well to find which versions of Python are available. I recommend taking a look at all the modules to see what is available to you when you are first getting started.   

Now that we know it exists, we  are ready to load the module:

[abc1234@computer ~]$ module load python/3.7.2--gcc-7.4.0-6on2qnpy 

...

Now we can check that the module was installed: 

[abc1234@computer ~]$ module list
Currently Loaded Modulefiles   
  1) tools-dir   
  2) module_defaults   
  3) system_defaults   
  4) module_rhel7   
  5) module_class   
  6) ncurses/6.1-gxx-7.4.0-6f66ubcf   
  . . .   
 17) python/3.7.2-gcc-7.4.0-6on2qnpy

If we ran this command prior to loading Python you would only see the first five modules that are loaded as default. We can also see many other modules that were loaded alongside Python. Not all modules load other with it; it depends on what the module needs and how it changes the environment.

...

To make sure the version was updated we can check the version again:

[abc1234@computer ~]$ python -V
Python 3.7.2

...

Now let’s say we are done using that version of Python or we loaded the wrong one and  we want to change it. We need to unload it:

[abc1234@computer ~]$ module unload python/3.7.2--gcc-7.4.0-6on2qnpy 

...

[abc1234@computer ~]$ module unload[module1][module2] [module3]…

Note: The autocomplete protip would speed up the process significantly and prevent typos that would break the command.

Tricky Modules

Sometimes modules are not explicitly listed in module avail. For example, idl, which is used by many imaging scientists does not look to be available. This is because it is contained in another module, envi. The following demonstrates this:

[abc1234@computer ~]$ which idl
/usr/bin/which: no idl in (/tools/spack/spackages/...)
[abc1234@computer ~]$ module load envi
[abc1234@computer ~]$ which idl
/tools/envi/5.2/idl84/bin/idl

The which command here is useful to see if you can run a program without trying to open it.

Making Your Changes Permanent

Loading modules is not permanent; when you close the terminal it will go back to its original environment. If you know that every time you open the terminal you will need to load certain modules you can edit your .bashrc to load the modules automatically when the terminal is open. To do this:

...

Open .bashrc (located as a hidden file in your home directory) with your choice of text editor:

[abc1234@computer ~]$ vim ~/.bashrc

If this is your first time editing .bashrc it should look like this:
Image Removed

...

module load [module]

In this example I will be loading the default Matlab module:

Image Removed

...

[abc1234@computer ~]$ source ~/.bashrc

...

Now when you run module list you will see your module there as loaded

...

Modules and Scripts

When you are using modules you must take caution when writing scripts that define the interpreter in the file. For example in a Python script the first line is commonly:

...

If you are using modules and decide to use a version of Python that is not the default, such as 3.7.2, this line will not point to that interpreter, but rather the default. Instead use:

#!/usr/bin/env python

This will point to the version of Python you loaded into your environment.

If there are any further questions, or there is an issue with the documentation, please contact rc-help@rit.edu for additional assistance.This wiki page is deprecated. You can find this documentation on our new documentation site: https://research-computing.git-pages.rit.edu/docs/using_modules.html