Getting started with the I2BC cluster
Objective 2
Analysing resource consumption and adjusting the resources you ask for.
Analysing resource consumption
The cluster is a shared resource so it’s important to make sure that your queries are submitted with a reasonable amount of asked resources. Default parameters are 2Gb of RAM memory, 1 CPU and a maximum running time of 2 hrs.
Remember qstat
? With the right options, it will tell you how much resources your job has actually used vs the resources you’ve asked for (and reserved):
john.doe@cluster-i2bc:/home/john.doe$ qstat -fxw -G 918860.pbsserver
Job Id: 918860.pbsserver
session_id = 1790323
Resource_List.mem = 2gb
Resource_List.ncpus = 1
Resource_List.nodect = 1
Resource_List.place = pack
Resource_List.preempt_targets = QUEUE=lowprio
Resource_List.select = 1:mem=2gb:ncpus=1
Resource_List.walltime = 02:00:00
Job_Name = pbs_script.sh
Job_Owner = john.doe@master.example.org
resources_used.cpupercent = 0
resources_used.cput = 00:00:00
resources_used.mem = 3644kb
resources_used.ncpus = 1
resources_used.vmem = 10496kb
resources_used.walltime = 00:01:00
job_state = F
queue = common
How to read this output?
- lines starting with
Resource_List
state what resources you’ve reserved for your job - here, we see that we’ve reserved 2Gb of memory and 1 CPU
- lines starting with
resources_used
tell you what resources your job has actually used - here, we see that we’ve only used 3644kb (~3.6Mb) and approximately 0% of the CPU so we clearly don’t need more
Adjusting the resources you ask for
You can do this by specifying a few extra option when running qsub
. Useful options in this case are:
option | function |
---|---|
-l mem=xxMb -l mem=xxGb | reserve the specified amount of RAM memory |
-l ncpus=x | reserve the specified amount of processors (CPU) |
Since our previous job only used very little resources, there is no sens in reserving 2Gb, let’s reduce it to 100Mb. We’ve used 0% of the reserved CPU but 1 CPU is already the minimum so we’ll keep it that way.
There are 2 methods to specify these parameters to qsub
:
Method 1
Add these options at job submission:
john.doe@cluster-i2bc:/home/john.doe$ qsub -l mem=100Mb -l ncpus=1 pbs_script.sh
918861.pbsserver
john.doe@cluster-i2bc:/home/john.doe$
Method 2
Add these options directly to your PBS submission script:
#! /bin/bash
#PBS -l mem=100Mb
#PBS -l ncpus=1
echo "hello world"
sleep 60s
Note that the syntax is the same in both cases, with additionally the #PBS
prefix in the script and each directive should be on a separate line.
In method 2, you have to then re-submit your script with a plain qsub
:
john.doe@cluster-i2bc:/home/john.doe$ qsub pbs_script.sh
918862.pbsserver
In method 2, you have to then re-submit your script with a plain qsub
:
john.doe@cluster-i2bc:/home/john.doe$ qstat -x 918862.pbsserver
Job id Name User Time Use S Queue
---------------- ---------------- ---------------- -------- - -----
918862.pbsserver pbs_script.sh john.doe 0 Q common
NB: It’s important to note that increasing the number of processors (CPUs or threads) won’t accelerate your job if the software you’re using doesn’t support parallelisation.
Take home message
1) it’s important to adjust the resources you ask for to the job you’re running
2) qstat -fxw -G
gives you information on what your job actually used
3) you can adjust resources using options in the qsub
command, whether directly at execution or within the PBS submission script
4) any PBS options added to the script should be preceded by #PBS
and written at the top of the script