[slurm-users] Nodelist dependent environment setup ?

Bas van der Vlies bas.vandervlies at surfsara.nl
Mon Apr 6 07:00:31 UTC 2020


we have solve this with a symbolic link to the optimized libraries on 
the node, eg:
  * /sw/arch ---> sara/eb/AVX2
  * /sw/arch -->  sara/eb/AVX512

and make use of '/sara/sw' in our module files.

regards


On 04/04/2020 19:36, Sajid Ali wrote:
> Answering my own question so that it may serve as a reference:
> 
> This can be done by setting up a task prolog as shown below :
> ```
> #!/bin/sh
> #
> # Sample TaskProlog script that will print a batch job's
> # job ID and node list to the job's stdout.
> # Also sets the modulepath based on nodelist
> #
> 
> if [ X"$SLURM_STEP_ID" = "X" -a X"$SLURM_PROCID" = "X"0 ]
> then
>          echo "print =========================================="
>          echo "print SLURM_JOB_ID = $SLURM_JOB_ID"
>          echo "print SLURM_JOB_NODELIST = $SLURM_JOB_NODELIST"
>          echo "print =========================================="
> fi
> short_list=${SLURM_JOB_NODELIST##worker}
> if [ $short_list == "01" ]
> then
>          echo "export MODULEPATH=/home/path1"
> fi
> if [ $short_list == "02" ]
> then
>          echo "export MODULEPATH=/home/path2"
> fi
> ```
> 
> Note:  This was tested on my laptop using a set of docker containers 
> using this configuration : https://github.com/SciDAS/slurm-in-docker .
> 
> 
> 
> -- 
> Sajid Ali | PhD Candidate
> Applied Physics
> Northwestern University
> s-sajid-ali.github.io <http://s-sajid-ali.github.io>

-- 
--
Bas van der Vlies
| Operations, Support & Development | SURFsara | Science Park 140 | 1098 XG
Amsterdam
| T +31 (0) 20 800 1300 | bas.vandervlies at surfsara.nl | www.surfsara.nl |



More information about the slurm-users mailing list