[ 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*'')
  # 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

redirect std{out,err} to separate files with given names

qsub -S /bin/bash
  # Choose the interpreter of your script. 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
man qsub qstat qhold queue_conf sge_types complex
  # Find out all the gory details which are missing here. You'll have to do it one anyway:-).

Monitorování úloh

Časté a záludné problémy

Submitnutý job může znovu submitovat

Danovy starší zkušenosti s clusterem PBS (nikoli SGE) říkaly, že tohle nejde. Ale jde to, aspoň u nás. Příkazy qsub a spol. jsou kromě hlavy clusteru dostupné i na všech strojích clusteru, samozřejmě pokud váš soubor .bashrc, .cshrc apod. zajistí, že se i na nich provede inicializace prostředí SGE.

Proměnné prostředí, nastavení vlastního prostředí

SGE spouští skripty v čistém prostředí. Nebuďte proto překvapeni, když vám skript na konzoli poběží dobře, ale po submitnutí fungovat nebude. Třeba nenašel potřebné programy v $PATH

Zatím nevím přesně, které ze souborů .login, .bashrc ap. SGE spouští, jestli vůbec nějaké. Naopak, experimentálně jsem ověřil, že qsub -S /bin/bash skript nenačte žádný z .bashrc, .bash_profile, .login, ani .profile.

Z toho například také vyplývá, že bez ošetření se jako Java používá

 java version "1.5.0"
 gij (GNU libgcj) version 4.1.2 20070502 (Red Hat 4.1.2-12)

Pokud chcete submittovaný program pouštět ve svém oblíbeném prostředí (např. nastavení PATH), musíte v obalujícím skriptu příslušné .bash* načíst. Vždy je ale bezpečnější všude psát plné cesty, než spoléhat na PATH.

Jiný shell

Abych mohl poslat nějakou úlohu do fronty, musím pro ni vyrobit vlastní skript. Budiž, vyrobil jsem vlastní skript:

#!/bin/bash
program > log.out 2> log.err

Když tento skript spustím, stane se očekávané. Přesměrují se výstupy z daného programu do souborů a je to.

Když takový skript submitnu, program se nespustí. V logu zjistím, že (standardní chybový) výstup shellu, který pouštěl můj skript praví kryptickou zprávu “Ambiguous redirect”.

Nebudu vás napínat, zde je vysvětlení: SGE ignoruje první řádek skriptu (ve skutečnosti je pravda horší, hledá v něm nějaké parametry pro sebe) a spouští skript v csh. Rozdíl mezi bashem a csh se v primitivních skriptech na první pohled nepozná, pozná se až v konstrukci if-then-else, a také v přesměrovávání. csh nerozumí přesměrování 2>

Takto SGE přinutíte, aby použilo bash:

  qsub -S /bin/bash skript

Jinou možností je přesměrovat stderr a stdout pomocí syntaxe csh:

( command >stdout_file ) >&stderr_file

bashrc a podobné nesmí nic vypisovat na konzoli

Opsáno z http://www.sara.nl/userinfo/lisa/usage/batch/index.html.

It is important, that the files that are sourced during a login such as .bash_profile .profile .bashrc .login .cshrc don't produce any output when a non-interactive login is done. If they do, changes are that your job will run, but that the batch system is unable to deliver to you the standard output and error files. In that case the status of your job will be 'E' after the job is finished. Here is an example how you can test in a .bash_profile or .bashrc if this is an interactive login:

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

Jak zjistit, jaké zdroje jsem pro svou úlohu požadoval

qstat -j 973884,982737,984029,984030,984031,984034,984036 | grep resource
hard resource_list:         mem_free=50g
hard resource_list:         mem_free=200g
hard resource_list:         mem_free=16g
hard resource_list:         mem_free=16g
hard resource_list:         mem_free=16g
hard resource_list:         mem_free=31g

Jak rezervovat více jader na stejném stroji pro 1 job

qsub -pe smp <pocet jader>

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