EDA Solutions logo

Setting up Linux Modules

Published by Khalid Teama – Latest update: 10/03/2022

ID: TN030
Relevant product(s): All
Operating systems: RHEL (any)
Versions affected: 2020.2.R1 and below
Relevant area(s): CAD Management

Summary

Using Modules in Linux is a neat way to manage and use multiple revisions of your EDA tools. Modules consists of a Tcl script which is run from a user shell. The only requirement is a working version of tclsh (version 8.4 or later) available on your system. tclsh is a part of Tcl.

Setup

  • Install environment modules:
$ yum install environment-modules -y
  • Create a folder to store the modules:
$ sudo mkdir /modules
  • Create Sub-folder to store the modules themselves:
$ cd /modules
$ mkdir /tanner
  • Add template to the /modules folder and copy and modify the template to satisfy the needs of the different modules.

.template looks like:

#%Module

set current_mode [module-info mode]

set bn [exec basename $ModulesCurrentModulefile]

set TANNER /opt/MentorGraphics/Tanner/$bn/tanner

setenv TANNER_PATH $TANNER

prepend-path PATH $TANNER/bin

                Example is:

#%Module

set current_mode [module-info mode]

set bn 2019.2u3

set TANNER /opt/MentorGraphics/Tanner/$bn/tanner

setenv TANNER_PATH $TANNER

prepend-path PATH $TANNER/bin

  • Add Modules to .bashrc
$ vi ~/.bashrc

Append the line:

export MODULEPATH=/usr/share/Modules/modulefiles:/modules

Usage

To see all available modules, run module avail.

$ module avail

To use a particular module, run module load modulename. You don’t need to list the full name of the module, if you only use the first component, it will choose the latest version for you. (It actually chooses the last item alphabetically.) For example:

$ module load tanner calibre

Or equivalently…

$ module load tanner
$ module load calibre

To unload a module, run module unload modulename. For example:

$ module unload tanner calibre
$ module list
No Module files Currently Loaded.

As you can see, the tanner and calibre modules have been unloaded.

Do not put the module load modulename command in your shell’s startup script (e.g., .bashrc) as it can lead to difficulties in diagnosing problems.

Instead, use the module command in your scripts and the module will be loaded when it is run.

To see exactly which environment variables the module modifies, run module show modulename.

References

RHEL Guide: Introduction to Modules