Environment
Shells
On CRESCO clusters the supported shells are bash/sh, ksh, and tcsh/csh.
The behavior of shells may vary depending on the type of shell. A shell can be of three different types:
login shell: the shell that starts when logging into the system after entering a username and password;
interactive shell: a shell that allows commands to be entered; it may also be a login shell;
non-interactive shell: a shell that is launched whenever a script is executed.
Depending on the shell type, the system reads different configuration files. Ignoring system scripts, the user-level configuration files are summarized in the following table.
Shell |
interactive |
non-interactive |
login |
|---|---|---|---|
t(csh) |
~/.cshrc |
~/.cshrc |
~/.login |
ba(sh) |
~/.bashrc |
$BASH_ENV |
~/.profile |
ksh |
~/.kshrc |
nothing |
~/.profile |
From this scheme it is possible to determine which configuration files are read by each shell type.
Modules
Modules allows you to configure a shell environment. The main advantages of Modules, which make it particularly suitable for an infrastructure such as ENEAGRID, are:
independence from the shell and the platform used;
modular configuration, which makes environment management simple and clean;
convenience and clarity when dynamically modifying the environment.
CRESCO clusters provide a wide variety of compilers, libraries, and other software, some of which are available in multiple versions.
Each module contains the information required to configure an application by modifying or setting shell environment variables such as PATH, MANPATH, etc.
All information regarding Modules can be found at the link
Environment Initialization
When logging into CRESCO clusters, the user’s environment is loaded.
The configuration files are:
~/.profilefor bash and ksh, which contain a call to /afs/enea.it/profile/common/profile~/.loginfor tcsh and csh, which contain a call to /afs/enea.it/profile/common/login
Using Modules
The following commands are available to show or initialize your environment:
COMMAND |
DESCRIPTION |
|---|---|
module avail |
List all or matching available modules |
module list |
List all or matching loaded modules |
module whatis |
Print whatis information of modulefile |
module add | load |
Load modulefile |
module rm | unload |
Remove modulefile |
module reload |
Unload then load all loaded modulefiles |
module switch | swap [mod1] mod2 |
Unload mod1 and load mod2 |
module is-loaded |
Test if any of the modulefiles are loaded |
Note
To check all the avaiable commands with their description use module command.
Custom Modules
It is possible to override the defaults set by administrators and load a preferred modulefile at login.
Each cluster has an environment variable {ENEAGRID_CLUSTER_ID} that identifies the cluster where the user is currently working. For example, on CRESCO8:
echo $ENEAGRID_CLUSTER_ID
cresco8
To create custom modules, simply access the hidden .Modules directory in your HOME and create or edit the file {ENEAGRID_CLUSTER_ID}.default.
Note
Each cluster can have its own user-specific configuration, distinguished by the {ENEAGRID_CLUSTER_ID} variable. For example, on the CRESCO8 cluster, the file will be named cresco8.default.
Inside this file, you can define the modules to be loaded:
#%Module1.0
module-version mpi_flavour/mvapich2_gcc_qlc-1.7 default
#At the next login, Modules will load mpi_flavour with mvapich2_gcc_qlc-1.7 as the default version
module avail
mpi_flavour/mvapich2_gcc_qlc-1.7(default) mpi_flavour/openmpi_gcc-1.5.4 mpi_flavour/openmpi_open64-1.5.4
Within the same file .Modules/cresco8.default, the user can load additional modulefiles among those available and optionally add custom ones.
To make a custom script visible to Modules, simply add the directory containing it to the ModulePath using the module use command:
module use /afs/enea.it/fra/user/USER/.Modules/
module avail
cresco8.default custom_modules
Writing a Modules script is quite simple:
the first line must be
#%Module1.0it must follow
tclsyntaxit should use the commands provided by Modules
For more information, you can refer to existing modulefiles and the following documentation: