[slurm-users] Using "Environment Modules" in a SLURM script

Yair Yarom irush at cs.huji.ac.il
Sun Jan 24 11:18:28 UTC 2021


We also use the lmod system. We found that besides the user's shell, it
also depends on how you install it. I.e. need to be active for general
shell and not just for login shells (bashrc vs. profile). Also, for e.g.
/bin/sh, it might not read any init file at all.

As we might have different modules between different nodes and between the
nodes and the submission machine, we actually don't want the modules to
pass across from the submission node to the cluster. As such, we're using
here spank and TaskProlog plugins to reset the modules on execution. Users
can run the 'module load' in their script, but can also use '--module
<module>' as srun/sbatch parameters which can be useful for scripts which
the module don't support.


On Fri, Jan 22, 2021 at 6:37 PM Peter Kjellström <cap at nsc.liu.se> wrote:

> On our slurm clusters the module system (Lmod) works without extra init
> in job scripts due to the environment-forwarding in slurm. "module" in
> the submitting context (in bash) on the login node is an "exported"
> function and as such makes it across.
>
> /Peter
>
> On Fri, 22 Jan 2021 10:41:06 +0000
> Gestió Servidors <sysadmin.caos at uab.cat> wrote:
>
> > Hello,
> >
> > I use "Environment Modules" (http://modules.sourceforge.net/) in my
> > SLURM cluster. In my scripts I do need to add an explicit
> > "source /soft/modules-3.2.10/Modules/3.2.10/init/bash". However, in
> > several examples I have read about SLURM scripts, nobody comments
> > that. So, have I forgotten a parameter in SLURM to "capture"
> > environment variables into the script or is it a problem due to my
> > distribution (CentOS-7)???
> >
> > Thanks.
>
>
>

-- 

  /|       |
  \/       | Yair Yarom | System Group (DevOps)
  []       | The Rachel and Selim Benin School
  [] /\    | of Computer Science and Engineering
  []//\\/  | The Hebrew University of Jerusalem
  [//  \\  | T +972-2-5494522 | F +972-2-5494522
  //    \  | irush at cs.huji.ac.il
 //        |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20210124/77eb6fb6/attachment-0001.htm>


More information about the slurm-users mailing list