[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

This is an old revision of the document!


Table of Contents

ÚFAL Grid Engine (LRC)

LRC (Linguistic Research Cluster) is a name of ÚFAL's computational grid/cluster, which has (as of 2017/09) about 1600 CPU cores (115 servers + 2 submission heads), with a total 10 TiB of RAM. It uses (Sun/Oracle/Son of) Grid Engine software (SGE) for job scheduling etc. You can submit many computing tasks (jobs) at once, they will be placed in a queue and once a machine (slot) with the required capabilities (e.g. RAM, number of cores) is available, your job will be executed (scheduled) on this machine. This way we can maximize the usefulness of the computing resources and divide it among users in a fair way.

If you need GPU processing, see a special page about our GPU cluster called DLL (which is actually a subsystem of LRC with independent queue gpu.q).

List of Machines

Last update: 2017/09. All machines have Ubuntu 14.04.
Some machines are at Malá Strana (ground floor, new server room built from Lindat budget), some are at Troja (5 km north-east).
If you need to quickly distinguish which machine is located where, you can use your knowledge of Trojan war-related heroes, qhost -q, or the tables below.

Troja (troja-all.q)

Name CPU type GHz cores RAM(GB) note
achilles[1-8] Intel 3.2 32 128
hector[1-8] Intel 1.3 32 128
helena[1-8] Intel 2.6 32 128
paris[1-8] Intel 2.4 32 128

MS = Malá Strana (ms-all.q)

Name CPU type GHz cores RAM(GB) note
andromeda[1-13] AMD 2xCore4 Opteron 2.8 8 32
hydra[1-4] AMD 2.6 16 128
fireball[1-10] Intel ??2xCore4 Xeon 3.0 4 32
hyperion[1-9] Intel 2xCore2 Xeon 3.0 4 32
lucifer[1-10] Intel ??2xCore4 Xeon 2.4 16 128
orion[1-6] Intel 2xCore4 Xeon 2.3 8 32
orion[7-10] Intel 2.0 4 32
tauri[1-10] Intel ??2xCore4 Xeon 3.0 4 32
cosmos Intel 4xCore2 Xeon 2.9 8 256
belzebub Intel 8xCore4 Xeon 2.9 32 256
iridium Intel ??2xCore4 Xeon 1.9 16 512 also in gpu.q
twister[1,2] Intel 2xCore4 Xeon 2.4 8 48 also in gpu.q

Outside LRC cluster (but located as MS)

Name CPU type GHz cores RAM(GB) note
lrc[1,2] Intel 2.3 4 45 no computing here, just submit jobs
pandora[1-10] 2xCore2 Intel Xeon 2.6 16 special cluster&queue ms-guests.q
sol[1-5] Intel 2.6 4 16 you can ssh here and compute
sol[6-8] Intel 2.0 8 16 you can ssh here and compute

The two lrc machines are so called heads of the cluster. No computation is allowed here, i.e. no CPU-intensive, disk-intensive nor RAM-intensive computation (very simple scripts are OK). You should just ssh to lrc1 or lrc2 and submit your jobs as described bellow.

Alternatively, you can ssh to one of the sol machines and submit jobs from here. It is allowed to compute here, which is useful e.g. when you have a script which submits your jobs, but it also collects statistics from the jobs outputs (and possibly submits new jobs conditioned on the statistics). However, the sol machines are relatively slow and may be occupied by your colleagues, so for bigger (longer) tasks, always prefer submission as separate jobs.

The pandora machines are in a special cluster (not accessible from lrc) and queue ms-guests.q available for our colleagues from KSVI and for students of Data intensive computing (see the 2016 handouts if you missed the course).

Installation

Add the following line into your '~/.bash_profile'.

source /net/projects/SGE/user/sge_profile

This detects if you are on one of the cluster machines (including lrc and sol) and sets env variables accordingly. It also prints a status message.
Usually, this is the first line of your '~/.bash_profile' and the second-and-last line is

[ -f ~/.bashrc ] && source ~/.bashrc

Basic usage

First, you need to ssh to the cluster head (lrc1 or lrc2) or to one of the sol machines. The full address is lrc1.ufal.hide.ms.mff.cuni.cz, but you can use just ssh lrc1 (“hide” means it is accessible only from the ÚFAL network, not from outside; if working from home/Eduroam, you need to login/VPN to the ÚFAL network first).

ssh lrc1
echo 'hostname; pwd; echo The second parameter is $2' > script.sh
  # prepare a shell script describing your task
qsub -cwd -j y script.sh Hello World
  # This submits your job to the default queue, which is currently ''ms-all.q''.
  # Usually, there is a free slot, so the job will be scheduled within few seconds.
  # We have used two handy qsub parameters:
  #  -cwd  ... the script is executed in the current directory (the default is your home)
  #  -j y  ... stdout and stderr outputs are merged and redirected to a file (''script.sh.o$JOB_ID'')
  # We have also provided two parameters for our script "Hello" and "World".
  # The qsub prints something like
  #   Your job 121144 ("script.sh") has been submitted
qstat
  # This way we inspect all our jobs (both waiting in queue and scheduled, i.e. running).
qstat -u '*' | less
  # This shows jobs of all users.
qstat -j 121144
  # This shows detailed info about the job with this number (if it is still running).
less script.sh.o*
  # We can inspect the job's output (in our case stored in script.sh.o121144).
  # Hint: if the job is still running, press F in 'less' to simulate 'tail -f'.

The output of our job should look like:

LRC:ubuntu 14.04: 8.1.7a Son of Grid Engine variables set...
lucifer5
/home/popel/tmp
The second parameter is World
======= EPILOG: Tue Sep 26 19:49:05 CEST 2017
== Limits:   
== Usage:    cpu=00:00:00, mem=0.00000 GB s, io=0.00000 GB, vmem=N/A, maxvmem=N/A
== Duration: 00:00:02 (2 s)

Our admins configured the SGE to print some extra info on stderr: the first line and then the epilog.
The mem=XY GB s means gigabytes of RAM used times the duration of the job in seconds, so don't be afraid XY is usually a very high number (unlike in this toy example).
The maxvmem means the peak virtual memory consumption (which is useful for setting h_vmem, see below).

qdel 121144
  # This way you can delete ("kill") a job with a given number, or comma-or-space separated list of job numbers.
qdel \*
  # This way you can delete all your jobs. Don't be afraid - you cannot delete others jobs.

Rules

The purpose of these rules is to prevent your jobs to damage the work of your colleagues and to divide the resources among users in a fair way.

Memory

Advanced usage

qsub -q troja-all.q
This way your job is submitted to the Troja queue. The default is ms-all.q. You can also use e.g.
-q '(troja*|ms*)' to submit on any machine in those two queues (but don't use -q '*' as this includes also gpu.q),
-q '*@hector[14]' to submit on hecor1 or hector4,
-q '[tm]*@!(hector*|iridium)' to submit on any troja/ms machine except hectors and iridium.
However, usually you should specify just the queue (troja-all.q vs. ms-all.q), not a particular machine, and instead use -l to specify the needed resources in a general way.

qsub -l
See man complex (run it on lrc or sol machines) for a list of possible resources you may require (in addition to mem_free etc. discussed above).

qsub -p -100
Define a priority of your job as a number between -1024 and 0. Only SGE admins may use a number higher than 0. The default is 0, i.e. the highest possible priority. SGE uses the priority to decide when to start which pending job in the queue (it computes a real number called prior, which is reported in qstat, which grows as the job is waiting in the queue). Note that once a job is started, you cannot “unschedule” it, so from that moment on, it is irrelevant what was its priority.

qsub -o LOG.stdout -e LOG.stderr
redirect std{out,err} to separate files with given names, instead of the defaults $JOB_NAME.o$JOB_ID and $JOB_NAME.e$JOB_ID.

qsub -@ optionfile
Instead of specifying all the qsub options on the command line, you can store them in a file (you can use # comments in the file). See also In-script options.

qsub -a 12312359
Execute your job no sooner than at the given time (in [YY]MMDDhhmm format). An alternative to sleep 3600 && qsub … &.

qsub -b y
Treat script.sh (or whatever is the name of the command you execute) as a binary, i.e. don't search for in-script options within the file, don't transfer it to the qmaster and then to the execution node. This makes the execution a bit faster and it may prevent some rare but hard-to-detect errors caused SGE interpreting the script. The script must be available on the execution node via NFS, Lustre (which is our case), etc. With -b y (shortcut for -b yes), script.sh can be a script or a binary. With -b n (which is the default for qsub), script.sh must be a script (text file).

qsub -M popel@ufal.mff.cuni.cz,rosa@ufal.mff.cuni.cz -m beas
Specify the emails where you want to be notified when the job has been b started, e ended, a aborted or rescheduled, s suspended.

qsub -hold_jid 121144,121145
The current job is not executed before all the specified jobs are completed.

qsub -now y
Start the job immediately or not at all, i.e. don't put it as pending to the queue. This is the default for qrsh, but you can change it with -now n (which is the default for qsub).

qsub -N my-name
By default the name of a job (which you can see e.g. in qstat) is the name of the script.sh. This way you can override it.

qsub -S /bin/bash
The hashbang (!#/bin/bash) in your script.sh is ignored, but you can change the interpreter with -S. I think /bin/bash is now (2017/09) the default (but it used to be csh).

qsub -v PATH
Export a given environment variable from the current shell to the job.

qsub -V
Export all environment variables. (This is not so needed now, when bash is the default interpreter and it seems your ~/.bashrc is always sourced.)

qsub -soft -l … -hard -l … -q …
By default, all the resource requirements (specified with -l) and queue requirements (specified with -q) are hard, i.e. your job won't be scheduled unless they can be fulfilled. You can use -soft to mark all following requirements as nice-to-have. And with -hard you can switch back to hard requirements.

qsub -sync y
This causes qsub to wait for the job to complete before exiting (with the same exit code as the job). Useful in scripts.

qalter
You can change some properties of already submitted jobs, which are still waiting in the queue (pending).

man qsub qstat qalter qhold queue_conf sge_types complex
Find out all the gory details which are missing here. You'll have to do it one day anyway:-).

qsub wrappers

If you often run (ad-hoc) bash commands via qsub, check ~bojar/tools/shell/qsubmit or ~stepanek/bin/qcmd, which allow you to enter the command on command line without creating any temp script files. The wrappers have also other features (some qsub options have changed default values). qcmd is older, but unlike qsubmit it has POD documentation, correct time computation and you don't need to quote the command.

qunhold

~stepanek/bin/qunhold tries to keep the number of running SGE jobs under a given threshold: all jobs over the threshold are held. If the number of running jobs goes below the threshold (default: 100), 10 jobs (by default) are unheld. Beware: if your jobs submit new jobs, you can get far over the threshold!

sshcwd

This is useful not only when sshing to sol machines. Add the following lines to your ~/.bashrc.

function sshcwd () {
  # save the current history so that it is available
  # immediately on the remote machine
  history -a;
  # setup the working directory by setting WD
  ssh -X -Y -C -t $@ "WD='$PWD' /bin/bash --login -i";
}

# use WD to setup the working directory
if [ -n "$WD" ]; then
  echo "Autochanging dir to $WD" >&2
  cd $WD;
fi

alias sol1="sshcwd sol1.ufal.hide.ms.mff.cuni.cz"

In-script options

If you don't use -b y, you can write the qsub options into script.sh instead of providing them on the command line. So your script.sh can be e.g.

#$ -l mem_free=10G,act_mem_free=10G,h_vmem=10G
#$ -pe smp 8
#$ -cwd -j y
#$ -N name-of-my-job
./what/to/run

and you execute it now simply with qsub script.sh.

Array jobs

If you have a set of tasks (of the same type) and want to run them on multiple machines, use qsub -t.

Job monitoring

Other

unset INTERACTIVE
/usr/bin/tty > /dev/null 2>&1
/usr/bin/test $? = 0 && INTERACTIVE=yes
...
if [ "$INTERACTIVE" ]; then
  ... commands only for truly interactive sessions ...
fi

TODO: Is this restriction still true (for our cluster)? E.g. .bash_profile with /net/projects/SGE/user/sge_profile prints info messages on stderr and it is OK.


[ Back to the navigation ] [ Back to the content ]