[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
grid [2017/09/27 20:45]
popel [Rules]
grid [2017/10/07 02:09]
rosa [Advanced usage] +holding on job names also possible
Line 1: Line 1:
 ====== ÚFAL Grid Engine (LRC) ====== ====== Ú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 [[https://en.wikipedia.org/wiki/Oracle_Grid_Engine|(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.+LRC (Linguistic Research Cluster) is a name of ÚFAL's computational grid/cluster, which has (as of 2017/09) about 1800 CPU cores (115 servers + 2 submission heads), with a total 10 TiB of RAM. It uses [[https://en.wikipedia.org/wiki/Oracle_Grid_Engine|(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|GPU cluster called DLL]] (which is actually a subsystem of LRC with independent queue ''gpu.q'').+If you need GPU processing, see a special page about our [[:gpu|GPU cluster called DLL]] (which is actually a subsystem of LRC with an independent queue ''gpu.q''). 
 +TODO: describe alternatives, e.g.: MetaCentrum / Cesnet cluster (all MFF students can use it), Amazon EC2, Microsoft Azure (some colleagues may have sometime free vouchers).
  
 ===== List of Machines ===== ===== List of Machines =====
Line 36: Line 37:
 ^ Name                ^ CPU type            ^ GHz ^cores ^ RAM(GB)^ note  ^ ^ Name                ^ CPU type            ^ GHz ^cores ^ RAM(GB)^ note  ^
 | lrc[1,2]            | Intel               | 2.3 |    4 |   45 | **no computing here**, just submit jobs | | 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[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 | | sol[6-8]            | Intel               | 2.0 |    8 |   16 | you can ssh here and compute |
Line 43: Line 43:
  
 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. 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 [[http://ufal.mff.cuni.cz/courses/npfl102|Data intensive computing]] (see the 2016 handouts if you missed the course). 
  
 ===== Installation ===== ===== Installation =====
Line 70: Line 68:
   # We have used two handy qsub parameters:   # We have used two handy qsub parameters:
   #  -cwd  ... the script is executed in the current directory (the default is your home)   #  -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*'')+  #  -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".   # We have also provided two parameters for our script "Hello" and "World".
   # The qsub prints something like   # The qsub prints something like
Line 135: Line 133:
  
 ===== Advanced usage ===== ===== 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|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'' ''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. 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'' ''qsub **-o** LOG.stdout **-e** LOG.stderr''
-redirect std{out,err} to separate files with given names+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'' ''qsub **-@** optionfile''
Line 153: Line 162:
 Specify the emails where you want to be notified when the job has been **b** started, **e** ended, **a** aborted or rescheduled, **s** suspended. 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''+''qsub **-hold_jid** 121144,121145'' or ''qsub **-hold_jid** get_src.sh,get_tgt.sh''
 The current job is not executed before all the specified jobs are completed. The current job is not executed before all the specified jobs are completed.
  
Line 161: Line 170:
 ''qsub **-N** my-name'' ''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. 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'' ''qsub **-S** /bin/bash''
Line 174: Line 182:
 ''qsub **-soft** -l ... **-hard** -l ... -q ...'' ''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. 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**'' ''**qalter**''
 You can change some properties of already submitted jobs, which are still waiting in the queue (//pending//). You can change some properties of already submitted jobs, which are still waiting in the queue (//pending//).
  
-''**man** qsub qstat qhold queue_conf sge_types complex''+''**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:-). Find out all the gory details which are missing here. You'll have to do it one day anyway:-).
  
Line 187: Line 198:
 === qunhold === === 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! ''~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''.
 +
 +<code>
 +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"
 +</code>
  
 === In-script options === === In-script options ===
Line 202: Line 234:
 === Array jobs === === Array jobs ===
  
-If you have a set of tasks (of the same type) and want to run them on multiple machines,... +If you have a set of tasks (of the same type) and want to run them on multiple machines, use ''qsub -t''. 
-TODO +  * ''-t 1-n'' start array job with n jobs numbered 1 ... n 
-===== Monitorování úloh =====+  * environmental variable ''SGE_TASK_ID'' 
 +  * output and error files ''$JOB_NAME.[eo]$JOB_ID.$TASK_ID'' 
 +  * ''-t m-n[:s]'' start array job with jobs m, m + s, ..., n 
 +  * environmental variables ''SGE_TASK_FIRST, SGE_TASK_LAST, SGE_TASK_STEPSIZE'' 
 +  * ''-tc j'' run at most j jobs simultaneously 
 +  * ''-hold_jid_ad comma_separated_job_list'' array jobs that must finish before this job starts; task //i// of the current job depends only on task //i// of the specified jobs
  
-  * ''qstat [-u user]'' -- seznam úloh aktuálně běžících / ve frontě +===== Job monitoring =====
-  * ''qhost'' -- dostupné zdroje +
-  * ''/SGE/REPORTER/LRC-UFAL/bin/lrc_users_real_mem_usage -u user -w'' -- aktuální využití paměti uživatelem +
-  * ''/SGE/REPORTER/LRC-UFAL/bin/lrc_users_limits_requested -w'' -- nárokované požadavky uživatelů +
-  * ''/SGE/REPORTER/LRC-UFAL/bin/lrc_nodes_meminfo'' -- vypis vsech uzlu a stav vytiznosti pameti. +
-    * mem_total: celkova pamet uzlu +
-    * mem_free: tedy kolik je jeste volne pameti z pametove quoty uzlu +
-    * act_mem_free: kolik uzlu OPRAVDU zbyva volne pameti +
-    * mem_used: kolik je pameti skutecne pouzito +
-  * ''/SGE/REPORTER/LRC-UFAL/bin/lrc_state_overview'' -- celkový přehled o clusteru +
-    * celkovy pocet jader, pocet vyuzitych jader +
-    * celkova velikost RAM, kolik je ji fyzicky nepouzite, kolik je ji jeste nerezervovane +
-    * po jednotlivych uzivatelich (zrovna pocitajicich) -- kolik jim bezi uloh, kolik jich maji ve fronte a kolik z nich je ve stavu hold +
-  * ''cat /SGE/REPORTER/LRC-UFAL/stats/userlist.weight'' -- seznam uživatelů clusteru seřazený podle dosavadní aktivity (počet odeslaných úloh × čas, který běžely), aktualizovaný každý den v&nbsp;noci +
-  * [[https://ufaladm2.ufal.hide.ms.mff.cuni.cz/munin/ufal.hide.ms.mff.cuni.cz/lrc1.ufal.hide.ms.mff.cuni.cz/lrc_users.html|Munin: graf vytíženosti clusteru podle uživatelů]] (viditelný pouze ze sítě ÚFAL)+
  
-===== Časté a záludné problémy ===== +  * ''qstat [-u user]'' -- print list of running/waiting jobs of a given user 
- +  * ''qhost'' -- print available/total resources 
- +  * ''/SGE/REPORTER/LRC-UFAL/bin/lrc_users_real_mem_usage -u user -w'' -- current memory usage of a given user 
-==== Submitnutý job může znovu submitovat ==== +  ''/SGE/REPORTER/LRC-UFAL/bin/lrc_users_limits_requested -w'' -- required resources of all users 
- +  ''/SGE/REPORTER/LRC-UFAL/bin/lrc_nodes_meminfo'' -- memory usage of all nodes 
-Danovy starší zkušenosti s clusterem PBS (nikoli SGE) říkaly, že tohle nejde. Ale jde to, aspoň u nás. Příkazy ''qsub''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. +    * mem_total: 
- +    mem_free: total memory minus reserved memory (using ''qsub -l mem_free''for each node 
- +    act_mem_free: really free memory 
- +    * mem_usedreally used memory 
-==== Proměnné prostředí, nastavení vlastního prostředí ==== +  * ''/SGE/REPORTER/LRC-UFAL/bin/lrc_state_overview'' -- overall summary (with per-user stats for users with running jobs
- +  ''cat /SGE/REPORTER/LRC-UFAL/stats/userlist.weight'' -- all users sorted according to their activity (number of submitted jobs × their average duration), updated each night 
-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'' +  [[http://ufaladm2/munin/ufal.hide.ms.mff.cuni.cz/lrc-headnode.ufal.hide.ms.mff.cuni.cz/index.html|Munin: graph of cluster usage by day and user]] and  [[http://ufaladm2/munin/ufal.hide.ms.mff.cuni.cz/apophis.ufal.hide.ms.mff.cuni.cz/index.html|Munin monitoring of Apophis disk server]] (both accessible only from ÚFAL network)
- +
-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 -/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+
- +
-<code> +
-#!/bin/bash +
-program > log.out 2> log.err +
-</code> +
- +
-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: +
- +
-<code> +
-  qsub -S /bin/bash skript +
-</code> +
- +
-Jinou možností je přesměrovat stderr a stdout pomocí syntaxe csh: +
- +
-<code> +
-command >stdout_file >&stderr_file +
-</code> +
- +
- +
-==== 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 doneIf 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 filesIn that case the status of your job will be 'E' after the job is finishedHere is an example how you can test in a .bash_profile or .bashrc if this is an interactive login:+
  
 +===== Other =====
 +  * There is a **great course [[http://ufal.mff.cuni.cz/courses/npfl102|Data intensive computing]]**, see the 2016 handouts if you missed the course. It covers the usage of [[http://spark.apache.org/|Spark]] (MapReduce/Hadoop alternative, but better) and HDFS (Hadoop filesystem).
 +  * This course had used a special **DLRC (Demo LRC) cluster** (students had to login with ''ssh -p 11422 ufallab.ms.mff.cuni.cz'' and special NPFL102-only LDAP logins) with six virtual machines on one physical. During the years when NPFL102 is not taught (e.g. 2017), the DLRC cluster has just one virtual machine.
 +  * You can use environment variables ''$JOB_ID'', ''$JOB_NAME''.
 +  * One job can submit other jobs (but be careful with recursive:-)). A job submitted to the CPU cluster may submit GPU jobs (to the ''qpu.q'' queue).
 +  * It is important, that the files that are sourced during a login such as .bash_profile, .profile, .bashrc, .login etc. 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:
 <code> <code>
 unset INTERACTIVE unset INTERACTIVE
Line 287: Line 273:
 fi fi
 </code> </code>
- +TODOIs 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.
-==== Jak zjistit, jaké zdroje jsem pro svou úlohu požadoval ==== +
- +
-<code>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</code> +
- +
-==== Jak rezervovat více jader na stejném stroji pro 1 job ==== +
- +
-<code> +
-qsub -pe smp <pocet jader> +
-</code>+
  

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