Project

General

Profile

Slurm » History » Version 47

Martin Kuemmel, 07/13/2015 01:19 PM

1 21 Kerstin Paech
{{toc}}
2 21 Kerstin Paech
3 46 Roy Henderson
h1. How to run jobs on the euclides nodes (using Slurm)
4 1 Kerstin Paech
5 42 Kerstin Paech
Use slurm to submit jobs or login to the euclides nodes (euclides1-12).
6 1 Kerstin Paech
7 9 Kerstin Paech
*Please read through this entire wikipage so everyone can make efficient use of this cluster*
8 9 Kerstin Paech
9 1 Kerstin Paech
h2. alexandria
10 1 Kerstin Paech
11 1 Kerstin Paech
*Please do not use alexandria as a compute node* - it's hardware is different from the nodes. It hosts our file server and other services that are important to us. 
12 1 Kerstin Paech
13 1 Kerstin Paech
You should use alexandria to
14 1 Kerstin Paech
- transfer files
15 1 Kerstin Paech
- compile your code
16 1 Kerstin Paech
- submit jobs to the nodes
17 1 Kerstin Paech
18 43 Kerstin Paech
If you need to debug and would like to login to a node, please start an interactive job to one of the nodes using slurm. For instructions see below.
19 1 Kerstin Paech
20 1 Kerstin Paech
h2. euclides nodes
21 1 Kerstin Paech
22 1 Kerstin Paech
Job submission to the euclides nodes is handled by the slurm jobmanager (see http://slurm.schedmd.com and https://computing.llnl.gov/linux/slurm/). 
23 47 Martin Kuemmel
*Important: In order to run jobs, you need to be added to the slurm accounting system - please contact Martin*
24 1 Kerstin Paech
25 4 Kerstin Paech
All slurm commands listed below have very helpful man pages (e.g. man slurm, man squeue, ...). 
26 4 Kerstin Paech
27 4 Kerstin Paech
If you are already familiar with another jobmanager the following information may be helpful to you http://slurm.schedmd.com/rosetta.pdf‎.
28 1 Kerstin Paech
29 1 Kerstin Paech
h3. Scheduling of Jobs
30 1 Kerstin Paech
31 9 Kerstin Paech
At this point there are two queues, called partitions in slurm: 
32 9 Kerstin Paech
* *normal* which is the default partition your jobs will be sent to if you do not specify it otherwise. At this point there is a time limit of
33 9 Kerstin Paech
two days. Jobs at this point can only run on 1 node.
34 16 Kerstin Paech
* *debug* which is meant for debugging, you can only run one job at a time, other jobs submitted will remain in the queue. Time limit is
35 16 Kerstin Paech
12 hours.
36 1 Kerstin Paech
37 38 Kerstin Paech
The default memory per core used is 2GB, if you need more or less, please specify with the --mem or --mem-per-cpu option.
38 38 Kerstin Paech
39 9 Kerstin Paech
We have also set up a scheduler that goes beyond the first come first serve - some jobs will be favoured over others depending
40 9 Kerstin Paech
on how much you or your group have been using euclides in the past 2 weeks, how long the job has been queued and how much
41 9 Kerstin Paech
resources it will consume.
42 9 Kerstin Paech
43 9 Kerstin Paech
This is serves as a starting point, we may have to adjust parameters once the slurm jobmanager is used. Job scheduling is a complex
44 9 Kerstin Paech
issue and we still need to build expertise and gain experience what are the user needs in our groups. Please feel free to speak out if
45 9 Kerstin Paech
there is something that can be improved without creating an unfair disadvantage for other users.
46 9 Kerstin Paech
47 9 Kerstin Paech
You can run interactive jobs on both partitions.
48 9 Kerstin Paech
49 41 Kerstin Paech
h3. Running an interactive job with slurm (a.k.a. logging in)
50 1 Kerstin Paech
51 9 Kerstin Paech
To run an interactive job with slurm in the default partition, use
52 1 Kerstin Paech
53 1 Kerstin Paech
<pre>
54 14 Kerstin Paech
srun -u --pty bash
55 1 Kerstin Paech
</pre>
56 9 Kerstin Paech
57 15 Shantanu Desai
If you want to use tcsh use
58 15 Shantanu Desai
59 15 Shantanu Desai
<pre>
60 15 Shantanu Desai
srun -u --pty tcsh
61 15 Shantanu Desai
</pre>
62 15 Shantanu Desai
63 30 Shantanu Desai
If you want to use a larger memory per job do
64 30 Shantanu Desai
65 30 Shantanu Desai
<pre>
66 31 Shantanu Desai
srun -u --mem-per-cpu=8000 --pty tcsh
67 30 Shantanu Desai
</pre>
68 30 Shantanu Desai
69 20 Kerstin Paech
In case you want to open x11 applications, use the --x11=first option, e.g.
70 20 Kerstin Paech
<pre>
71 20 Kerstin Paech
srun --x11=first -u   --pty  bash
72 20 Kerstin Paech
</pre>
73 20 Kerstin Paech
74 9 Kerstin Paech
In case the 'normal' partition is overcrowded, to use the 'debug' partition, use:
75 9 Kerstin Paech
<pre>
76 14 Kerstin Paech
srun --account cosmo_debug -p debug -u --pty bash # if you are part of the Cosmology group
77 14 Kerstin Paech
srun --account euclid_debug -p debug -u --pty bash  # if you are part of the EuclidDM group
78 12 Kerstin Paech
</pre> As soon as a slot is open, slurm will log you in to an interactive session on one of the nodes.
79 1 Kerstin Paech
80 44 Kerstin Paech
h3. limited ssh access
81 44 Kerstin Paech
82 44 Kerstin Paech
If you have an active job (batch or interactive), you can login to the node the job is running on. Your ssh session will be killed if the job terminates. Your ssh session will be restricted to the same resources as your job (so you cannot accidentally bypass the job scheduler and harm other user's jobs).
83 44 Kerstin Paech
84 10 Kerstin Paech
h3. Running a simple once core batch job with slurm using the default partition
85 1 Kerstin Paech
86 1 Kerstin Paech
* To see what queues are available to you (called partitions in slurm), run:
87 1 Kerstin Paech
<pre>
88 1 Kerstin Paech
sinfo
89 1 Kerstin Paech
</pre>
90 1 Kerstin Paech
91 1 Kerstin Paech
* To run slurm, create a myjob.slurm containing the following information:
92 1 Kerstin Paech
<pre>
93 1 Kerstin Paech
#!/bin/bash
94 1 Kerstin Paech
#SBATCH --output=slurm.out
95 1 Kerstin Paech
#SBATCH --error=slurm.err
96 1 Kerstin Paech
#SBATCH --mail-user <put your email address here>
97 1 Kerstin Paech
#SBATCH --mail-type=BEGIN
98 8 Kerstin Paech
#SBATCH -p normal
99 1 Kerstin Paech
100 1 Kerstin Paech
/bin/hostname
101 1 Kerstin Paech
</pre>
102 1 Kerstin Paech
103 1 Kerstin Paech
* To submit a batch job use:
104 1 Kerstin Paech
<pre>
105 1 Kerstin Paech
sbatch myjob.slurm
106 1 Kerstin Paech
</pre>
107 1 Kerstin Paech
108 1 Kerstin Paech
* To see the status of you job, use 
109 1 Kerstin Paech
<pre>
110 1 Kerstin Paech
squeue
111 1 Kerstin Paech
</pre>
112 1 Kerstin Paech
113 11 Kerstin Paech
* To kill a job use:
114 11 Kerstin Paech
<pre>
115 11 Kerstin Paech
scancel <jobid>
116 11 Kerstin Paech
</pre> the <jobid> you can get from using squeue.
117 11 Kerstin Paech
118 1 Kerstin Paech
* For some more information on your job use
119 1 Kerstin Paech
<pre>
120 1 Kerstin Paech
scontrol show job <jobid>
121 11 Kerstin Paech
</pre>the <jobid> you can get from using squeue.
122 1 Kerstin Paech
123 10 Kerstin Paech
h3. Running a simple once core batch job with slurm using the debug partition
124 10 Kerstin Paech
125 10 Kerstin Paech
Change the partition to debug and add the appropriate account depending if you're part of
126 10 Kerstin Paech
the euclid or cosmology group.
127 10 Kerstin Paech
128 10 Kerstin Paech
<pre>
129 10 Kerstin Paech
#!/bin/bash
130 10 Kerstin Paech
#SBATCH --output=slurm.out
131 10 Kerstin Paech
#SBATCH --error=slurm.err
132 10 Kerstin Paech
#SBATCH --mail-user <put your email address here>
133 10 Kerstin Paech
#SBATCH --mail-type=BEGIN
134 10 Kerstin Paech
#SBATCH -p debug
135 10 Kerstin Paech
#SBATCH -account [cosmo_debug/euclid_debug]
136 10 Kerstin Paech
137 10 Kerstin Paech
/bin/hostname
138 10 Kerstin Paech
</pre>
139 10 Kerstin Paech
140 22 Kerstin Paech
h3. Accessing a node where a job is running or starting additional processes on a node
141 22 Kerstin Paech
142 25 Kerstin Paech
You can attach an srun command to an already existing job (batch or interactive). This
143 22 Kerstin Paech
means you can start an interactive session on a node where a job of yours is running
144 26 Kerstin Paech
or start an additional process.
145 22 Kerstin Paech
146 22 Kerstin Paech
First determine the jobid of the desired job using squeue, then use 
147 22 Kerstin Paech
148 22 Kerstin Paech
<pre>
149 22 Kerstin Paech
srun  --jobid <jobid> [options] <executable> 
150 22 Kerstin Paech
</pre>
151 22 Kerstin Paech
Or more concrete
152 22 Kerstin Paech
<pre>
153 22 Kerstin Paech
srun  --jobid <jobid> -u --pty  bash # to start an interactive session
154 22 Kerstin Paech
srun  --jobid <jobid> ps -eaFAl  # to start get detailed process information 
155 22 Kerstin Paech
</pre>
156 22 Kerstin Paech
157 24 Kerstin Paech
The processes will only run on cores that have been allocated to you. This works 
158 24 Kerstin Paech
for batch as well as interactive jobs. 
159 23 Kerstin Paech
*Important: If the original job that was submitted is finished, any process 
160 23 Kerstin Paech
attached in this fashion will be killed.*
161 22 Kerstin Paech
162 10 Kerstin Paech
163 6 Kerstin Paech
h3. Batch script for running a multi-core job
164 6 Kerstin Paech
165 17 Kerstin Paech
mpi is installed on alexandria.
166 17 Kerstin Paech
167 18 Kerstin Paech
To run a 4 core job for an executable compiled with mpi you can use
168 6 Kerstin Paech
<pre>
169 6 Kerstin Paech
#!/bin/bash
170 6 Kerstin Paech
#SBATCH --output=slurm.out
171 6 Kerstin Paech
#SBATCH --error=slurm.err
172 6 Kerstin Paech
#SBATCH --mail-user <put your email address here>
173 6 Kerstin Paech
#SBATCH --mail-type=BEGIN
174 6 Kerstin Paech
#SBATCH -n 4
175 1 Kerstin Paech
176 18 Kerstin Paech
mpirun <programname>
177 1 Kerstin Paech
178 1 Kerstin Paech
</pre>
179 18 Kerstin Paech
and it will automatically start on the number of nodes specified.
180 1 Kerstin Paech
181 18 Kerstin Paech
To ensure that the job is being executed on only one node, add
182 18 Kerstin Paech
<pre>
183 18 Kerstin Paech
#SBATCH -n 4
184 18 Kerstin Paech
</pre>
185 18 Kerstin Paech
to the job script.
186 17 Kerstin Paech
187 19 Kerstin Paech
If you would like to run a program that itself starts processes, you can use the
188 19 Kerstin Paech
environment variable $SLURM_NPROCS that is automatically defined for slurm
189 19 Kerstin Paech
jobs to explicitly pass the number of cores the program can run on.
190 19 Kerstin Paech
191 17 Kerstin Paech
To check if your job is acutally running on the specified number of cores, you can check
192 17 Kerstin Paech
the PSR column of
193 17 Kerstin Paech
<pre>
194 17 Kerstin Paech
ps -eaFAl
195 17 Kerstin Paech
# or ps -eaFAl | egrep "<yourusername>|UID" if you just want to see your jobs
196 6 Kerstin Paech
</pre>
197 27 Jiayi Liu
198 28 Kerstin Paech
h3. environment for jobs
199 27 Jiayi Liu
200 29 Kerstin Paech
By default, slurm does not initialize the environment (using .bashrc, .profile, .tcshrc, ...)
201 29 Kerstin Paech
202 28 Kerstin Paech
To use your usual system environment, add the following line in the submission script:
203 27 Jiayi Liu
<pre>
204 27 Jiayi Liu
#SBATCH --get-user-env
205 1 Kerstin Paech
</pre>
206 1 Kerstin Paech
207 28 Kerstin Paech
208 28 Kerstin Paech
h2. Software specific setup
209 28 Kerstin Paech
210 28 Kerstin Paech
h3. Python environment 
211 28 Kerstin Paech
212 28 Kerstin Paech
You can use the python 2.7.3 installed on the euclides cluster by using
213 27 Jiayi Liu
214 27 Jiayi Liu
<pre>
215 27 Jiayi Liu
source /data2/users/ccsoft/etc/setup_all
216 37 Kerstin Paech
source  /data2/users/ccsoft/etc/setup_python2.7.3
217 33 Shantanu Desai
</pre>
218 32 Shantanu Desai
219 32 Shantanu Desai
220 34 Shantanu Desai
h2. Notes For Euclid users
221 32 Shantanu Desai
222 35 Shantanu Desai
For those submitting jobs to euclides* nodes through Cosmo DM pipeline  here are some things which need to be specified for customized job submissions,
223 35 Shantanu Desai
since a different interface to slurm is used.
224 34 Shantanu Desai
225 34 Shantanu Desai
* To use larger memory per block , specify max_memory = 6000 (for 6G) and so on. inside block definition or in the submit file (in
226 34 Shantanu Desai
case you want to use it for all blocks)
227 34 Shantanu Desai
228 34 Shantanu Desai
* If you want to run on multiple cores/cores then use 
229 34 Shantanu Desai
nodes='<number of nodes>:ppn=<number of cores> inside the block definition of a particular block or in the submit file in case you want
230 1 Kerstin Paech
to use it for all blocks.
231 34 Shantanu Desai
232 35 Shantanu Desai
* If you want to use a larger wall time then specify wall_mod=<wall time in minutes> inside the module definition
233 39 Shantanu Desai
234 40 Shantanu Desai
* note that queue=serial does not work on alexandria(we usually use it for c2pap)
235 45 Roy Henderson
236 45 Roy Henderson
h1. Admin
237 45 Roy Henderson
238 45 Roy Henderson
h2. Adding a new user
239 45 Roy Henderson
240 45 Roy Henderson
As root on @alexandria@,
241 45 Roy Henderson
242 45 Roy Henderson
<pre>
243 45 Roy Henderson
cd /data1/users/slurm/
244 45 Roy Henderson
./add_user.sh
245 45 Roy Henderson
</pre>
246 45 Roy Henderson
247 45 Roy Henderson
h2. To increase memory, cores etc for a user
248 45 Roy Henderson
249 45 Roy Henderson
Inside script above, various commands for changing user settings, e.g.
250 45 Roy Henderson
251 45 Roy Henderson
<pre>
252 45 Roy Henderson
/usr/local/bin/sacctmgr -i modify user  name=$1 set GrpCPUs=32
253 45 Roy Henderson
/usr/local/bin/sacctmgr -i modify user  name=$1 set GrpMem=128000
254 45 Roy Henderson
</pre>
Redmine Appliance - Powered by TurnKey Linux