[ 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/10/02 16:56]
popel [Advanced usage]
grid [2018/02/01 14:23]
popel [Advanced usage]
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 57: Line 55:
   [ -f ~/.bashrc ] && source ~/.bashrc   [ -f ~/.bashrc ] && source ~/.bashrc
  
 +Make sure you have correctly configured locale (otherwise ''qrsh'' may not show accented letters in ''less'' and you may get errors when printing utf8 on stdout/stderr from your script in ''qsub''). For example add the following line to your ''~/.bashrc'':  
 +
 +  export LC_ALL=en_US.UTF-8
 ===== Basic usage ===== ===== 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 [[internal:remote-access|login/VPN]] to the ÚFAL network first). 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 [[internal:remote-access|login/VPN]] to the ÚFAL network first).
 +In the following tutorial, we will prepare a wrapper shell script ''script.sh'' with a toy task. In practice you can name the script whatever you want and you can execute the real task, e.g. a Python/Perl/... script. It is recommended to use the wrapper shell scripts, but with ''-b y'' (see [[#advanced usage]]) you can execute a Python/Perl/... directly without any wrapper.
  
 <code> <code>
Line 120: Line 122:
     * If your job needs more than one CPU (on a single machine) for most of the time, reserve the given number of CPU cores (and SGE slots) with <code>qsub -pe smp <number-of-CPU-cores></code> As you can see in [[#List of Machines]], the maximum is 32 cores. If your job needs e.g. up to 110% CPU most of the time and just occasionally 200%, it is OK to reserve just one core (so you don't waste). TODO: when using ''-pe smp -l mf=8G,amf=8G,h_vmem=12G'', which memory limits are per machine and which are per core?     * If your job needs more than one CPU (on a single machine) for most of the time, reserve the given number of CPU cores (and SGE slots) with <code>qsub -pe smp <number-of-CPU-cores></code> As you can see in [[#List of Machines]], the maximum is 32 cores. If your job needs e.g. up to 110% CPU most of the time and just occasionally 200%, it is OK to reserve just one core (so you don't waste). TODO: when using ''-pe smp -l mf=8G,amf=8G,h_vmem=12G'', which memory limits are per machine and which are per core?
     * If you are sure your job needs less than 1GB RAM, then you can skip this. Otherwise, if you need e.g. 8 GiB, you must always use ''qsub'' (or ''qrsh'') with ''-l mem_free=8G''. You should specify also ''act_mem_free'' with the same value and ''h_vmem'' with possibly a slightly bigger value. See [[#memory]] for details. TL;DR: <code>qsub -l mem_free=8G,act_mem_free=8G,h_vmem=12G</code>      * If you are sure your job needs less than 1GB RAM, then you can skip this. Otherwise, if you need e.g. 8 GiB, you must always use ''qsub'' (or ''qrsh'') with ''-l mem_free=8G''. You should specify also ''act_mem_free'' with the same value and ''h_vmem'' with possibly a slightly bigger value. See [[#memory]] for details. TL;DR: <code>qsub -l mem_free=8G,act_mem_free=8G,h_vmem=12G</code> 
-  * Be kind to your colleagues. If you are going to submit jobs that effectively occupy **more than one fifth of our cluster for more than several hours**, check if the cluster is free (with ''qstat -g c'' or ''qstat -u \*'') and/or ask your colleagues if they don't plan to use the cluster intensively in the near future. Note that if you allocate one slot (CPU core) on a machine, but (almost) all its RAM, you have effectively occupied the whole machine and all its cores. If you are submitting **more than 100 jobs**, consider using setting them a low priority (e.g. ''-p -1024'', see below) or use [[#qunhold]]. Don't submit more than ca 2000 jobs at once (this can overload the SGE).+  * Be kind to your colleagues. If you are going to submit jobs that effectively occupy **more than one fifth of our cluster for more than several hours**, check if the cluster is free (with ''qstat -g c'' or ''qstat -u \*'') and/or ask your colleagues if they don't plan to use the cluster intensively in the near future. Note that if you allocate one slot (CPU core) on a machine, but (almost) all its RAM, you have effectively occupied the whole machine and all its cores. If you are submitting **more than 100 jobs**, consider using setting them a low priority (e.g. ''-p -1024'', see below) or use [[#qunhold]]. 
 +  * **Don't submit more than ca 5000 jobs at once**, even if you make sure that at most 100 are running/waiting and the rest is in the //hold// state (e.g. using ''qunhold''). More than 5000 jobs in the queue can overload the SGE, so then no one can execute ''qstat'' (or it takes too long).
  
  
Line 146: Line 149:
 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). 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** -99'' 
-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 0i.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. In January 2018we changed the default to -100 (it used to be 0). 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. You can ask for a higher priority (-99...0) if your job is urgent and/or will finish soon and you want to skip your colleagues' jobs in the queue. You should ask for lower priority (-1024..-101) if you submit many jobs at once or if the jobs are not urgent.
  
 ''qsub **-o** LOG.stdout **-e** LOG.stderr'' ''qsub **-o** LOG.stdout **-e** LOG.stderr''
Line 164: Line 167:
 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 172: Line 175:
 ''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''
 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''). 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''+''qsub **-v** PATH[=value]''
 Export a given environment variable from the current shell to the job. Export a given environment variable from the current shell to the job.
  
Line 210: Line 212:
   # immediately on the remote machine   # immediately on the remote machine
   history -a;   history -a;
-  # setup the working directory by setting WD +  # setup the working directory by setting WD, delete possible ".nfs/" 
-  ssh -X -Y -C -t $@ "WD='$PWD' /bin/bash --login -i";+  ssh -X -Y -C -t $@ "WD='${PWD/.nfs\//}' /bin/bash --login -i";
 } }
  
Line 237: Line 239:
 === Array jobs === === Array jobs ===
  
-If you have a set of tasks (of the same type) and want to run them on multiple machines, use ''qsub -t''... +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 
 +  * 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
  
-===== Monitorování úloh =====+=== Delete many jobs at once === 
 +For deleting all your jobs use ''qdel \*''. For deleting array jobs (see above), you can use comma-separated ranges of task ids, e.g. ''qdel -t 1,10,50-100''
 +For deleting a range of (normal) job ids, you can use bash expansion (as an alternative to ''seq''), e.g. ''qdel {17979..18028}''.
  
-  * ''qstat [-u user]'' -- seznam úloh aktuálně běžících / ve frontě +=== Ssh to random sol === 
-  * ''qhost'' -- dostupné zdroje +Ondřej Bojar suggests to add the following alias to your .bashrc (cf. [[#sshcwd]])
-  * ''/SGE/REPORTER/LRC-UFAL/bin/lrc_users_real_mem_usage -u user -w'' -- aktuální využití paměti uživatelem +<code>alias cluster='comp=$(($RANDOM /4095 +1)); ssh -o "StrictHostKeyChecking no" sol$comp'</code>
-  * ''/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_totalcelkova 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 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 =====+===== Job monitoring =====
  
 +  * ''qstat [-u user]'' -- print a 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
 +  * ''/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
 +    * mem_total:
 +    * mem_free: total memory minus reserved memory (using ''qsub -l mem_free'') for each node
 +    * act_mem_free: really free memory
 +    * mem_used: really used memory
 +  * ''/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
 +  * [[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)
  
-==== Submitnutý job může znovu submitovat ==== +===== Other ===== 
- +  * There is a **great course [[http://ufal.mff.cuni.cz/courses/npfl102|Data intensive computing]]**see the 2016 handouts if you missed the courseIt covers the usage of [[http://spark.apache.org/|Spark]] (MapReduce/Hadoop alternativebut better) and HDFS (Hadoop filesystem)
-Danovy starší zkušenosti s clusterem PBS (nikoli SGE) říkaly, že tohle nejdeAle jde to, aspoň u násPříkazy ''qsub'' a spoljsou kromě hlavy clusteru dostupné i na všech strojích clusterusamozřejmě pokud váš soubor ''.bashrc'', ''.cshrc'' apodzajistíže se i na nich provede inicializace prostředí SGE+  * This course had used a special **DLRC (Demo LRC) cluster** (students had to login with ''ssh -11422 ufallab.ms.mff.cuni.cz'' and special NPFL102-only LDAP logins) with six virtual machines on one physicalDuring the years when NPFL102 is not taught (e.g2017)the DLRC cluster has just one virtual machine
- +  * **Note:** soma hadoop basics and a lot of NoSQL technologies are covered by [[https://is.cuni.cz/studium/predmety/index.php?do=predmet&kod=NDBI040|Big Data Management and NoSQL Databases]] 
- +  * 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)
-==== Proměnné prostředí, nastavení vlastního prostředí ==== +  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:
- +
-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'' apSGE 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+
- +
-==== 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: +
 <code> <code>
 unset INTERACTIVE unset INTERACTIVE
Line 295: Line 287:
 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>+
  

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