User Tools

Site Tools


environment_modules

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
environment_modules [2020/01/29 22:03]
root created
environment_modules [2020/02/04 19:01] (current)
root
Line 1: Line 1:
 ==== Environment Modules, .bashrc ==== ==== Environment Modules, .bashrc ====
  
-The [[http://modules.sourceforge.net/|Modules]] package is supplied on the system to set up the users's environment variables to run a choice of the needed programs and versions. The most important of these variables are ''$PATH'', telling the system where to find executable files such as ''matlab'' or ''mpirun'', and ''$LD_LIBRARY_PATH'', telling the system where to find shared libraries that an executable calls.  You can manipulate the environment variables yourself instead of calling modules, but there is no advantage in doing so.+==Modules== 
 +When multiple versions of software are installed, some method is needed to use the version you want to use.  The  
 +[[http://modules.sourceforge.net/|Modules]] package is the overwhelming choice of HPC centers for this. 
 +Modules is supplied on the system to manipulate the users's environment variables to run a choice of the needed programs and versions. The most important of these variables are ''$PATH'', telling the system where to find executable files such as ''matlab'' or ''mpirun'', and ''$LD_LIBRARY_PATH'', telling the system where to find shared libraries that an executable calls and requires.  You can manipulate the environment variables yourself instead of calling modules, but generally there is no advantage in doing so.
  
 The four critical module commands are ''list'' (currently loaded),''avail'' (all available), ''load'', and ''purge''. The combination purge/load clears all loaded modules and sets new ones: The four critical module commands are ''list'' (currently loaded),''avail'' (all available), ''load'', and ''purge''. The combination purge/load clears all loaded modules and sets new ones:
Line 25: Line 28:
 </code> </code>
  
-''module avail'' can be slow to load. A quicker way to see the top-level names only is (on either cluster, this is razor)+''module avail'' can be slow to load. A quicker way to see the top-level names only is (on any cluster, this is razor)
 <code> <code>
 $ ls /share/apps/modulefiles $ ls /share/apps/modulefiles
Line 44: Line 47:
 ''ls -R /share/apps/modulefiles | more'' gives a full list of every file. ''ls -R /share/apps/modulefiles | more'' gives a full list of every file.
  
-The default .bashrc loaded with a new account includes three ''module'' loads.+==.bashrc== 
 +A script file in each user's home directory called ''.bashrc'' also sets environment variables such as ''$PATH'' and ''$LD_LIBRARY_PATH'' at each login.  Since the file name begins with a period, the file is "hidden" so it does not register by ''ls'' but does register by ''ls -a''
 + 
 +If you use a different shell than ''bash'' such as ''tcsh'', there will be an analogous file such as ''.cshrc'' which does the same functions in ''csh'' syntax. 
 + 
 +The default .bashrc loaded with a new account includes three ''module'' loads.  You can and usually should edit this file to get the effect you want.
 <code> <code>
 $ cat ~/.bashrc $ cat ~/.bashrc
Line 64: Line 72:
 </code> </code>
  
-''.bashrc'' is sourced at the beginning of each interactive job. There is a similar file ''.bash_profile'' sourced at the beginning of each non-interactive job.  In our setup, we source ''.bashrc'' from ''.bash_profile'' so that the files are effectively the same, thus reducing the maintenance effort.    Interactive or batch is determined in ''.bashrc'' by ''[ -z "$PS1" ] && return'' which drops out of the loop on batch runs, so commands following that are for interactive sessions only, like setting the value of the prompt ''$PS1'' Commands towards the top of ``.bashrc`` are for both interactive and batch.  You can add commands to ''.bash_profile'' for batch jobs only.+''.bashrc'' is sourced at the beginning of each interactive job. There is a similar file ''.bash_profile'' sourced at the beginning of each non-interactive job.  In our setup, we source ''.bashrc'' from ''.bash_profile'' so that the files are effectively the same, thus reducing the maintenance effort, but you can separate them if necessary Interactive or batch is determined in ''.bashrc'' by ''[ -z "$PS1" ] && return'' which drops out of the loop on batch runs, so commands following that are for interactive sessions only, like setting the value of the prompt ''$PS1'' Commands towards the top of ``.bashrc`` are for both interactive and batch.  You can add commands to ''.bash_profile'' for batch jobs only.
  
-For csh-users, module commands should operate identically under ''tcsh'' but they are untested.+For csh-users, module commands should operate identically under ''tcsh'' but they are generally untested.
  
-Here are some recommended module/.bashrc setups for different cases:+On multiple-node parallel jobs, ''.bashrc'' can do some unexpected things as the system spawns a shell on each node.  Here are some recommended module/.bashrc setups for different cases:
  
 ** You run only one program, or all the programs you run use the same modules, or each uses different modules that don't conflict ** ** You run only one program, or all the programs you run use the same modules, or each uses different modules that don't conflict **
environment_modules.1580335420.txt.gz · Last modified: 2020/01/29 22:03 by root