Set Environment variables and Path in SERC
There are many environment variables used by programs in Linux. For example, the environment variable HOME
points to the home folder of the user. To see the usage, try :
This shows your home directory. PATH
is another important environment variable which sets the locations in which programs search for the required files/executables.
In SERC, many programs (like compilers, matlab, etc.) are installed in various folders. We need to actually go to these folders and then run the desired programs which is a messy task. Instead, we can specify the locations of these executables in a configuration file so that the system automatically looks into these places when we try to, say, compile a program. There are many other uses of setting environment variables. But which variables to set depends on the requirements of the user. Let us see how to do this in SERC clusters.
First you need to find out which shell you are using in the terminal by the command,
The above indicates that you are using the C shell. Some Linux systems may be using the bash shell as default. Whichever shell you are using, there is a configuration file which sets up the environmental variables and default paths for that shell. For C shell, this will located in ~/.cshrc
and, for bash shell, this will be ~/.bashrc
. Note that ~
indicates your home directory (/home/course/year/username).
Steps to modify the .cshrc/.bashrc
file:
- Open the file in a text editor: (you can use vi or gedit)
-
Insert the appropriate paths and environment variables for your required software. I have given the most used ones at the end of this post.
-
Save the file and close.
-
You have to source that file for the changes to take effect. Do:
Add the following lines to the ~/.cshrc file for the corresponding software mentioned.
For Tyrone cluster: Torque batch system: You must add this to submit any job in Tyrone cluster.
Intel Fortran compiler:
MPI support for Intel compilers: (by mvapich2)
Ansys - Fluent:
Matlab:
Mathematica:
For IBM Blue Gene/L :
where the first line is for the load leveler which schedules jobs, the second line is for the IBM XL Fortran compiler and the last line for the GNU compilers for Blue Gene/L.
If you want access to other softwares, you can have a look at the directories /home/pkg/lic
and /opt
. After adding these paths and sourcing the .cshrc
file, you can start the desired program by simply entering the executable name in the terminal from anywhere. e.g. matlab
will start the Matlab R2014a program.