Training sessions on high performance computing are offered every semester. See the CSCAR WEBSITE for information and schedule.

Creating your own modules

Creating a module for yourself

There may be a situation in which it makes best sense to install software for yourself or for your group. It can be convenient to create a module file for it and use the module command to make it available for yourself and others. For the examples that follow, the fictional user grundoon will be used. Your uniqname should appear where grundoon appears here.

Creating a module for a program with one version

The first step is to install whatever software will be made accessible by the module you create. For the sake of this example, let us assume that the software is installed into your home directory in a utilities subdirectory. The software has one executable, hello, and it has one library, libhello.so, that is needed. The installation creates the standard directories under ~/utilities, namely, ~/utilities/bin and ~/utilities/lib. To set up the environment manually, you would need to run these commands.

The first line is required to identify this as a module file. The next three lines set variables that the module command can use when it is run. The first sets the version number, the second the application name, and the third sets the root directory for the application.

The prepend-path command instructs module to add to the front of your PATH the directory ~/utilities/bin (filling in the value of $modroot). The append-path command instructs module to add to the back of your LD_LIBRARY_PATH the directory ~/utilities/lib.

In this case, we want to be sure that our version of hello is used before any others in the PATH, but we are confident that there are no other libhello.so libraries, so we add to the end of LD_LIBRARY_PATH.

Creating a module for a program with multiple versions

If you need to have multiple versions of your program available, you can create a module for each version. To make our utilities module example into a versioned module, create a subdirectory called utilities instead of a file, then put the module definition into a file named for the version, for example, 1.0, within the utilities directory. Doing so would result in

If, at some point, you create a module file for version 1.1, you would create a module file called ~/privatemodules/utilities/1.1, after which module load utilities would load version 1.1, and you would have to use

$ module load utilities/1.0

to load the older version. However, there may be occasions when you want the older version to be the default, for example, if you have projects underway that use the older version, but you have a new project that needs a feature in the new version. You can set a default version by creating a file called .version in the program’s module directory. For example, to make version 1.0 the default version for the utilities module, put the lines

#%Module1.0
set ModulesVersion "1.0"

into ~/privatemodules/utilities/.version. Note, again, that the first line is required to mark it as a module command file. This will give