Project

General

Profile

Slurm » History » Version 51

Sebastian Bocquet, 11/27/2015 09:48 AM

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 51 Sebastian Bocquet
* transfer files
15 51 Sebastian Bocquet
* compile your code
16 51 Sebastian Bocquet
* submit jobs to the nodes
17 1 Kerstin Paech
18 1 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 51 Sebastian Bocquet
22 51 Sebastian Bocquet
h3. Hardware overview
23 51 Sebastian Bocquet
24 51 Sebastian Bocquet
* There are 12 compute nodes named euclides1--euclides12
25 51 Sebastian Bocquet
* euclides8 hosts a virtual machine and is not available for computing
26 51 Sebastian Bocquet
* euclides12 is only available for debugging, see below
27 51 Sebastian Bocquet
* each node has 32 logical CPUs and 64GB of RAM
28 1 Kerstin Paech
29 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/). 
30 47 Martin Kuemmel
*Important: In order to run jobs, you need to be added to the slurm accounting system - please contact Martin*
31 1 Kerstin Paech
32 4 Kerstin Paech
All slurm commands listed below have very helpful man pages (e.g. man slurm, man squeue, ...). 
33 4 Kerstin Paech
34 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‎.
35 1 Kerstin Paech
36 1 Kerstin Paech
h3. Scheduling of Jobs
37 1 Kerstin Paech
38 9 Kerstin Paech
At this point there are two queues, called partitions in slurm: 
39 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
40 9 Kerstin Paech
two days. Jobs at this point can only run on 1 node.
41 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
42 16 Kerstin Paech
12 hours.
43 1 Kerstin Paech
44 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.
45 38 Kerstin Paech
46 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
47 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
48 9 Kerstin Paech
resources it will consume.
49 9 Kerstin Paech
50 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
51 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
52 9 Kerstin Paech
there is something that can be improved without creating an unfair disadvantage for other users.
53 9 Kerstin Paech
54 9 Kerstin Paech
You can run interactive jobs on both partitions.
55 9 Kerstin Paech
56 41 Kerstin Paech
h3. Running an interactive job with slurm (a.k.a. logging in)
57 1 Kerstin Paech
58 9 Kerstin Paech
To run an interactive job with slurm in the default partition, use
59 1 Kerstin Paech
60 1 Kerstin Paech
<pre>
61 14 Kerstin Paech
srun -u --pty bash
62 1 Kerstin Paech
</pre>
63 9 Kerstin Paech
64 15 Shantanu Desai
If you want to use tcsh use
65 15 Shantanu Desai
66 15 Shantanu Desai
<pre>
67 15 Shantanu Desai
srun -u --pty tcsh
68 15 Shantanu Desai
</pre>
69 15 Shantanu Desai
70 30 Shantanu Desai
If you want to use a larger memory per job do
71 30 Shantanu Desai
72 30 Shantanu Desai
<pre>
73 31 Shantanu Desai
srun -u --mem-per-cpu=8000 --pty tcsh
74 30 Shantanu Desai
</pre>
75 30 Shantanu Desai
76 20 Kerstin Paech
In case you want to open x11 applications, use the --x11=first option, e.g.
77 20 Kerstin Paech
<pre>
78 20 Kerstin Paech
srun --x11=first -u   --pty  bash
79 20 Kerstin Paech
</pre>
80 20 Kerstin Paech
81 9 Kerstin Paech
In case the 'normal' partition is overcrowded, to use the 'debug' partition, use:
82 9 Kerstin Paech
<pre>
83 14 Kerstin Paech
srun --account cosmo_debug -p debug -u --pty bash # if you are part of the Cosmology group
84 14 Kerstin Paech
srun --account euclid_debug -p debug -u --pty bash  # if you are part of the EuclidDM group
85 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.
86 1 Kerstin Paech
87 44 Kerstin Paech
h3. limited ssh access
88 44 Kerstin Paech
89 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).
90 44 Kerstin Paech
91 10 Kerstin Paech
h3. Running a simple once core batch job with slurm using the default partition
92 1 Kerstin Paech
93 1 Kerstin Paech
* To see what queues are available to you (called partitions in slurm), run:
94 1 Kerstin Paech
<pre>
95 1 Kerstin Paech
sinfo
96 1 Kerstin Paech
</pre>
97 1 Kerstin Paech
98 1 Kerstin Paech
* To run slurm, create a myjob.slurm containing the following information:
99 1 Kerstin Paech
<pre>
100 1 Kerstin Paech
#!/bin/bash
101 1 Kerstin Paech
#SBATCH --output=slurm.out
102 1 Kerstin Paech
#SBATCH --error=slurm.err
103 1 Kerstin Paech
#SBATCH --mail-user <put your email address here>
104 1 Kerstin Paech
#SBATCH --mail-type=BEGIN
105 8 Kerstin Paech
#SBATCH -p normal
106 1 Kerstin Paech
107 1 Kerstin Paech
/bin/hostname
108 1 Kerstin Paech
</pre>
109 1 Kerstin Paech
110 1 Kerstin Paech
* To submit a batch job use:
111 1 Kerstin Paech
<pre>
112 1 Kerstin Paech
sbatch myjob.slurm
113 1 Kerstin Paech
</pre>
114 1 Kerstin Paech
115 1 Kerstin Paech
* To see the status of you job, use 
116 1 Kerstin Paech
<pre>
117 1 Kerstin Paech
squeue
118 1 Kerstin Paech
</pre>
119 1 Kerstin Paech
120 11 Kerstin Paech
* To kill a job use:
121 11 Kerstin Paech
<pre>
122 11 Kerstin Paech
scancel <jobid>
123 11 Kerstin Paech
</pre> the <jobid> you can get from using squeue.
124 11 Kerstin Paech
125 1 Kerstin Paech
* For some more information on your job use
126 1 Kerstin Paech
<pre>
127 1 Kerstin Paech
scontrol show job <jobid>
128 11 Kerstin Paech
</pre>the <jobid> you can get from using squeue.
129 1 Kerstin Paech
130 10 Kerstin Paech
h3. Running a simple once core batch job with slurm using the debug partition
131 10 Kerstin Paech
132 10 Kerstin Paech
Change the partition to debug and add the appropriate account depending if you're part of
133 10 Kerstin Paech
the euclid or cosmology group.
134 10 Kerstin Paech
135 10 Kerstin Paech
<pre>
136 10 Kerstin Paech
#!/bin/bash
137 10 Kerstin Paech
#SBATCH --output=slurm.out
138 10 Kerstin Paech
#SBATCH --error=slurm.err
139 10 Kerstin Paech
#SBATCH --mail-user <put your email address here>
140 10 Kerstin Paech
#SBATCH --mail-type=BEGIN
141 10 Kerstin Paech
#SBATCH -p debug
142 10 Kerstin Paech
#SBATCH -account [cosmo_debug/euclid_debug]
143 10 Kerstin Paech
144 10 Kerstin Paech
/bin/hostname
145 10 Kerstin Paech
</pre>
146 10 Kerstin Paech
147 22 Kerstin Paech
h3. Accessing a node where a job is running or starting additional processes on a node
148 22 Kerstin Paech
149 25 Kerstin Paech
You can attach an srun command to an already existing job (batch or interactive). This
150 22 Kerstin Paech
means you can start an interactive session on a node where a job of yours is running
151 26 Kerstin Paech
or start an additional process.
152 22 Kerstin Paech
153 22 Kerstin Paech
First determine the jobid of the desired job using squeue, then use 
154 22 Kerstin Paech
155 22 Kerstin Paech
<pre>
156 22 Kerstin Paech
srun  --jobid <jobid> [options] <executable> 
157 22 Kerstin Paech
</pre>
158 22 Kerstin Paech
Or more concrete
159 22 Kerstin Paech
<pre>
160 22 Kerstin Paech
srun  --jobid <jobid> -u --pty  bash # to start an interactive session
161 22 Kerstin Paech
srun  --jobid <jobid> ps -eaFAl  # to start get detailed process information 
162 22 Kerstin Paech
</pre>
163 22 Kerstin Paech
164 24 Kerstin Paech
The processes will only run on cores that have been allocated to you. This works 
165 24 Kerstin Paech
for batch as well as interactive jobs. 
166 23 Kerstin Paech
*Important: If the original job that was submitted is finished, any process 
167 23 Kerstin Paech
attached in this fashion will be killed.*
168 22 Kerstin Paech
169 10 Kerstin Paech
170 6 Kerstin Paech
h3. Batch script for running a multi-core job
171 6 Kerstin Paech
172 17 Kerstin Paech
mpi is installed on alexandria.
173 17 Kerstin Paech
174 18 Kerstin Paech
To run a 4 core job for an executable compiled with mpi you can use
175 6 Kerstin Paech
<pre>
176 6 Kerstin Paech
#!/bin/bash
177 6 Kerstin Paech
#SBATCH --output=slurm.out
178 6 Kerstin Paech
#SBATCH --error=slurm.err
179 6 Kerstin Paech
#SBATCH --mail-user <put your email address here>
180 6 Kerstin Paech
#SBATCH --mail-type=BEGIN
181 6 Kerstin Paech
#SBATCH -n 4
182 1 Kerstin Paech
183 18 Kerstin Paech
mpirun <programname>
184 1 Kerstin Paech
185 1 Kerstin Paech
</pre>
186 18 Kerstin Paech
and it will automatically start on the number of nodes specified.
187 1 Kerstin Paech
188 18 Kerstin Paech
To ensure that the job is being executed on only one node, add
189 18 Kerstin Paech
<pre>
190 18 Kerstin Paech
#SBATCH -n 4
191 18 Kerstin Paech
</pre>
192 18 Kerstin Paech
to the job script.
193 17 Kerstin Paech
194 19 Kerstin Paech
If you would like to run a program that itself starts processes, you can use the
195 19 Kerstin Paech
environment variable $SLURM_NPROCS that is automatically defined for slurm
196 19 Kerstin Paech
jobs to explicitly pass the number of cores the program can run on.
197 19 Kerstin Paech
198 17 Kerstin Paech
To check if your job is acutally running on the specified number of cores, you can check
199 17 Kerstin Paech
the PSR column of
200 17 Kerstin Paech
<pre>
201 17 Kerstin Paech
ps -eaFAl
202 17 Kerstin Paech
# or ps -eaFAl | egrep "<yourusername>|UID" if you just want to see your jobs
203 6 Kerstin Paech
</pre>
204 27 Jiayi Liu
205 28 Kerstin Paech
h3. environment for jobs
206 27 Jiayi Liu
207 29 Kerstin Paech
By default, slurm does not initialize the environment (using .bashrc, .profile, .tcshrc, ...)
208 29 Kerstin Paech
209 28 Kerstin Paech
To use your usual system environment, add the following line in the submission script:
210 27 Jiayi Liu
<pre>
211 27 Jiayi Liu
#SBATCH --get-user-env
212 1 Kerstin Paech
</pre>
213 1 Kerstin Paech
214 28 Kerstin Paech
215 28 Kerstin Paech
h2. Software specific setup
216 28 Kerstin Paech
217 28 Kerstin Paech
h3. Python environment 
218 28 Kerstin Paech
219 28 Kerstin Paech
You can use the python 2.7.3 installed on the euclides cluster by using
220 27 Jiayi Liu
221 27 Jiayi Liu
<pre>
222 27 Jiayi Liu
source /data2/users/ccsoft/etc/setup_all
223 37 Kerstin Paech
source  /data2/users/ccsoft/etc/setup_python2.7.3
224 33 Shantanu Desai
</pre>
225 32 Shantanu Desai
226 32 Shantanu Desai
227 34 Shantanu Desai
h2. Notes For Euclid users
228 32 Shantanu Desai
229 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,
230 35 Shantanu Desai
since a different interface to slurm is used.
231 34 Shantanu Desai
232 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
233 34 Shantanu Desai
case you want to use it for all blocks)
234 34 Shantanu Desai
235 34 Shantanu Desai
* If you want to run on multiple cores/cores then use 
236 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
237 1 Kerstin Paech
to use it for all blocks.
238 34 Shantanu Desai
239 35 Shantanu Desai
* If you want to use a larger wall time then specify wall_mod=<wall time in minutes> inside the module definition
240 39 Shantanu Desai
241 40 Shantanu Desai
* note that queue=serial does not work on alexandria(we usually use it for c2pap)
242 45 Roy Henderson
243 45 Roy Henderson
h1. Admin
244 45 Roy Henderson
245 49 Martin Kuemmel
There is a user "slurm" which however is not really necessary for the administration work. The slurm administrator needs sudo access. Some script for adding a user and similar things are in "/data1/users/slurm". With the sudo access the admin can execute those scripts. In the mysql database there is the username "slurmdb" with password.
246 48 Martin Kuemmel
247 50 Sebastian Bocquet
h2. Overview over users, accounts, etc.
248 50 Sebastian Bocquet
249 50 Sebastian Bocquet
No sudo access needed:
250 50 Sebastian Bocquet
<pre>
251 50 Sebastian Bocquet
/usr/local/bin/sacctmgr show account withassoc
252 50 Sebastian Bocquet
</pre>
253 50 Sebastian Bocquet
254 45 Roy Henderson
h2. Adding a new user
255 45 Roy Henderson
256 45 Roy Henderson
As root on @alexandria@,
257 45 Roy Henderson
258 45 Roy Henderson
<pre>
259 45 Roy Henderson
cd /data1/users/slurm/
260 45 Roy Henderson
./add_user.sh
261 45 Roy Henderson
</pre>
262 45 Roy Henderson
263 45 Roy Henderson
h2. To increase memory, cores etc for a user
264 45 Roy Henderson
265 45 Roy Henderson
Inside script above, various commands for changing user settings, e.g.
266 45 Roy Henderson
267 45 Roy Henderson
<pre>
268 45 Roy Henderson
/usr/local/bin/sacctmgr -i modify user  name=$1 set GrpCPUs=32
269 45 Roy Henderson
/usr/local/bin/sacctmgr -i modify user  name=$1 set GrpMem=128000
270 45 Roy Henderson
</pre>
271 50 Sebastian Bocquet
272 50 Sebastian Bocquet
h2. Node state "drain"
273 50 Sebastian Bocquet
274 50 Sebastian Bocquet
When a node is in "drain" state when calling <pre>sinfo</pre>
275 50 Sebastian Bocquet
run
276 50 Sebastian Bocquet
<pre>
277 50 Sebastian Bocquet
/usr/local/bin/scontrol update nodename=NODE_NAME state=resume
278 50 Sebastian Bocquet
</pre>
279 50 Sebastian Bocquet
to put it back to operation.
280 48 Martin Kuemmel
281 48 Martin Kuemmel
h2. Nodes down
282 48 Martin Kuemmel
283 48 Martin Kuemmel
Sometimes nodes are reported as "down". This seems to happen as a result of network problems. Here is some "troubleshooting":https://computing.llnl.gov/linux/slurm/troubleshoot.html#nodes for this situation. Also after a re-boot of alexandria some manual work on slurm might be necessary to get going again.
Redmine Appliance - Powered by TurnKey Linux