# Differences

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

  
popel [Advanced usage]  |    
vodrazka [MS = Malá Strana (cpu-ms.q)]   
---|---  
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 **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.| +| LRC (Linguistic Research Cluster) is a name of ÚFAL'​s computational grid/​cluster,​ which has (as of **2018** /**06**) about **1728** CPU cores (**65** servers + **10** submission heads), with a total **7.2** 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 an 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**-ms**.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).| 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 =====  
-| Last update: 2017/**09**. All machines have Ubuntu ​**14**.04.| +| Last update: 2017/**06**. All machines have Ubuntu ​**18**.04.  
Some machines are at Malá Strana (ground floor, new server room built from Lindat budget), some are at Troja (5 km north-east).| 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 [[https://​en.wikipedia.org/​wiki/​Trojan_War|Trojan war]]-related heroes, ''​qhost -q'',​ or the tables below. ​| If you need to quickly distinguish which machine is located where, you can use your knowledge of [[https://​en.wikipedia.org/​wiki/​Trojan_War|Trojan war]]-related heroes, ''​qhost -q'',​ or the tables below. ​  
-| ==== **Troja (troja-all.q) ​** ====| +| ====**== AVX instructions ==** ====  
-| **^ 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) ====| +| ==== **Troja**(**cpu** -**troja**.q) ====  
+| **^ Name ^ CPU type ^ GHz ^cores ^RAM(GB)^ note ^**  
+| **| achilles[1-8] ​ | Intel(R) Xeon(R) CPU E5-2630 v3 | 2.4 | 31 | 123 | AVX enabled ​ |**  
+| **| hector[1-8] ​ | Intel(R) Xeon(R) CPU E5-2630 v3 | 2.4 | 31 | 123 | AVX enabled ​ |**  
+| **| helena[1-8] ​ | Intel(R) Xeon(R) CPU E5-2630 v3 | 2.4 | 31 | 123 | AVX enabled ​ |**  
+| **| paris[1-8] ​ | Intel(R) Xeon(R) CPU E5-2630 v3 | 2.4 | 31 | 123 | AVX enabled ​ |**  
-| **^ Name ^ CPU type ^ GHz ^cores ^RAM**(**GB)^ note ^**|  +| **==== MS = Malá Strana ​**(**cpu** -**ms**.q**) ====**  
-| **| 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 **and flags ​** ^ GHz ^cores ^RAM(GB)^ note ^   
-| ^ Name ^ CPU type ^ GHz ^cores ^ RAM(GB)^ note ^ | +| | **hydra**[1**-4**] **| AMD Opteron SSE4 AVX** | 2.**6** | **15** | **​122 ​ | AVX enabled ​** |   
-| | **lrc**[1**,2**] ​**| Intel** | 2.**3 | 4** | **45** | ****no computing here**, just submit jobs** | | +| | **orion**[1-**8**] | Intel**(R) Xeon(R) CPU E5-2630 v4** | 2.**2** | **39** | **​122 ​ | AVX enabled ​** |   
-| | **sol**[1-**5**] | Intel **​** | 2.**6 | 4** | **16** | **you can ssh here and compute ​** | | +| | **belzebub ​** | Intel **Xeon SSE4 AVX** | 2.**9** | **31 | 249 ​** | **AVX enabled ​** |  
-| | **sol[6-8] ​** | Intel **​** | 2.**0** | **​8 ​** | **16** | **you can ssh here and compute ​** || +| **| iridium ​ | Intel Xeon SSE4 | 1.9 | 15 | 501 | ​** |  
-| **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**.| +| **< ​html><​!**\--  
+| **sol5 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dtherm tpr_shadow**  
+| **sol7 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dtherm tpr_shadow**  
+| **andromeda4 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt hw_pstate npt lbrv svm_lock nrip_save vmmcall**  
+| **hydra1 ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold vmmcall**  
+| **fireball1 ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dtherm tpr_shadow**  
+| **hyperion1 ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dtherm tpr_shadow**  
+| **lucifer1 ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 popcnt aes lahf_lm kaiser tpr_shadow vnmi flexpriority ept vpid dtherm ida arat**  
+| **orion1 ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dtherm tpr_shadow vnmi flexpriority**  
+| **orion7 ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dtherm tpr_shadow**  
+| **tauri1 ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dtherm tpr_shadow**  
+| **cosmos ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm dtherm tpr_shadow vnmi flexpriority**  
+| **belzebub ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm epb kaiser tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm ida arat pln pts**  
+| **iridium ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 x2apic popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid**  
+| **twister1 ​ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 popcnt lahf_lm ida arat epb dtherm tpr_shadow vnmi flexpriority ept vpid**  
+| **\-- > **  
+| **< /​html>​ **  
+| **=== Submit hosts / test machines ===**  
+| **^ Name ^ CPU type ^ GHz ^cores ^** RAM**(GB) ^ note ^**  
+| **| sol[1** -**8] | Intel**(**R**) **Xeon(R) CPU E5-2630 v3 | 2**.**4 | 7 | ​28 ​ | you can** ssh **here** and **compute or** submit jobs **|**  
+| **| lrc[12] ​ | Intel(R) Xeon(R) CPU E5-2630 v4 | 2**.**2 | 4 | 4 | you can submit jobs here or monitor job execution - NO COMPUTATION IS ALLOWED HERE !!! |**  
-| **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.| +| **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.  
===== Installation =====| ===== Installation =====  
Line 48: | Line 56:  
Add the following line into your '​~/​.bash_profile'​.| Add the following line into your '​~/​.bash_profile'​.  
-|  source /**net** /**projects/​SGE/​user** /​sge_profile| +|  source /**opt** /**LRC** /​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.| +| **Or call one of these scripts directly:**  
+  
+| **/​opt/​LRC/​common/​settings.sh (for bash)**  
+| **/​opt/​LRC/​common/​settings.csh (for tcsh/csh)**  
+  
+| This detects if you are on one of the cluster machines (including 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| Usually, this is the first line of your '​~/​.bash_profile'​ and the second-and-last line is  
Line 58: | Line 71:  
export LC_ALL=en_US.UTF-8|  export LC_ALL=en_US.UTF-8  
+|  ​  
+| If you are curious about purpose of .bashrc and .bash_profile and you need to know when they should be used you may read [[https://​stackoverflow.com/​a/​415444|this]].  
+|  ​  
===== 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 one of the **submit hosts (** sol**[1-10])**. The full address is **(for example) ​** ''​**sol1**.ufal.hide.ms.mff.cuni.cz'',​ but you can use just ''​ssh ​**sol1** ''​ ("​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.| 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>​  
-| ssh **lrc1**|  +| ssh **sol1**  
echo '​hostname;​ pwd; echo The second parameter is $2' > script.sh| echo '​hostname;​ pwd; echo The second parameter is $2' > script.sh  
# prepare a shell script describing your task|  # prepare a shell script describing your task  
qsub -cwd -j y script.sh Hello World| qsub -cwd -j y script.sh Hello World  
-|  # This submits your job to the default queue, which is currently ''​**ms** -**all**.q''​.| +|  # This submits your job to the default queue, which is currently ''​**cpu** -*****.q''​.  
# Usually, there is a free slot, so the job will be scheduled within few seconds.|  # Usually, there is a free slot, so the job will be scheduled within few seconds.  
# We have used two handy qsub parameters:|  # We have used two handy qsub parameters:  
Line 122: | Line 138:  
* 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]].| +|  * 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**]] or (even better) [[#array jobs**]].  
* **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).|  * **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 133: | Line 149:  
* **act_mem_free** (or amf) is a ÚFAL-specific option, which specifies the real amount of free memory (at the time of scheduling). You can specify it when submitting a job and it will be scheduled to a machine with at least this amount of memory free. In an ideal world, where no jobs are exceeding their ''​mem_free''​ requirements,​ we would not need this options. However, in real world it is recommended to use this option with the same value as ''​mem_free''​ to protect your job from failing with out-of-memory error (because of naughty jobs of other users).|  * **act_mem_free** (or amf) is a ÚFAL-specific option, which specifies the real amount of free memory (at the time of scheduling). You can specify it when submitting a job and it will be scheduled to a machine with at least this amount of memory free. In an ideal world, where no jobs are exceeding their ''​mem_free''​ requirements,​ we would not need this options. However, in real world it is recommended to use this option with the same value as ''​mem_free''​ to protect your job from failing with out-of-memory error (because of naughty jobs of other users).  
* **h_vmem** is equivalent to setting ''​ulimit -v'',​ i.e. it is a hard limit on the size of virtual memory (see RLIMIT_AS in ''​man setrlimit''​). If your job exceeds this limit, memory allocation fails (i.e., malloc or mmap will return NULL), and your job will probably crash on SIGSEGV. TODO: according to ''​man queue_conf'',​ the job is killed with SIGKILL, not with SIGSEGV. Note that ''​h_vmem''​ specifies the maximal size of **allocated_memory,​ not used_memory**,​ in other words it is the VIRT column in ''​top'',​ not the RES column. SGE does not use this parameter in any other way. Notably, job scheduling is not affected by this parameter and therefore there is no guarantee that there will be this amount of memory on the chosen machine. The problem is that some programs (e.g. Java with the default setting) allocate much more (virtual) memory than they actually use in the end. If we want to be ultra conservative,​ we should set ''​h_vmem''​ to the same value as ''​mem_free''​. If we want to be only moderately conservative,​ we should specify something like h_vmem=1.5*mem_free,​ because some jobs will not use the whole mem_free requested, but still our job will be killed if it allocated much more than declared. The default effectively means that your job has no limits.|  * **h_vmem** is equivalent to setting ''​ulimit -v'',​ i.e. it is a hard limit on the size of virtual memory (see RLIMIT_AS in ''​man setrlimit''​). If your job exceeds this limit, memory allocation fails (i.e., malloc or mmap will return NULL), and your job will probably crash on SIGSEGV. TODO: according to ''​man queue_conf'',​ the job is killed with SIGKILL, not with SIGSEGV. Note that ''​h_vmem''​ specifies the maximal size of **allocated_memory,​ not used_memory**,​ in other words it is the VIRT column in ''​top'',​ not the RES column. SGE does not use this parameter in any other way. Notably, job scheduling is not affected by this parameter and therefore there is no guarantee that there will be this amount of memory on the chosen machine. The problem is that some programs (e.g. Java with the default setting) allocate much more (virtual) memory than they actually use in the end. If we want to be ultra conservative,​ we should set ''​h_vmem''​ to the same value as ''​mem_free''​. If we want to be only moderately conservative,​ we should specify something like h_vmem=1.5*mem_free,​ because some jobs will not use the whole mem_free requested, but still our job will be killed if it allocated much more than declared. The default effectively means that your job has no limits.  
-| **​** * It is recommended to **profile your task first**, so you can estimate reasonable memory requirements before submitting many jobs with the same task (varying in parameters which do not affect memory consumption). So for the first time, declare mem_free with much more memory than expected and ssh to a given machine and check ''​htop''​ (sum all processes of your job) or (if the job is done quickly) check the epilog. When running other jobs of this type, set ''​mem_free''​ (and ''​act_mem_free''​ and ''​h_vmem''​) so you are not wasting resources, but still have some reserve.| +| *** For GPU jobs, it is usually better to use **h_data** instead of **h_vmem**. CUDA driver allocates a lot of "​unused"​ virtual memory (tens of GB per card), which is counted in ''​h_vmem'',​ but not in ''​h_data''​. All usual allocations (''​malloc'',​ ''​new'',​ Python allocations) seem to be included in ''​h_data''​.**  
+| **​** * It is recommended to **profile your task first** ​**(see [[#​profiling]] below)** , so you can estimate reasonable memory requirements before submitting many jobs with the same task (varying in parameters which do not affect memory consumption). So for the first time, declare mem_free with much more memory than expected and ssh to a given machine and check ''​htop''​ (sum all processes of your job) or (if the job is done quickly) check the epilog. When running other jobs of this type, set ''​mem_free''​ (and ''​act_mem_free''​ and ''​h_vmem''​) so you are not wasting resources, but still have some reserve.  
* **s_vmem** is similar to ''​h_vmem'',​ but instead of SIGSEGV/​SIGKILL,​ the job is sent a SIGXCPU signal which can be caught by the job and exit gracefully before it is killed. So if you need it, set ''​s_vmem''​ to a lower value than ''​h_vmem''​ and implement SIGXCPU handling and cleanup.|  * **s_vmem** is similar to ''​h_vmem'',​ but instead of SIGSEGV/​SIGKILL,​ the job is sent a SIGXCPU signal which can be caught by the job and exit gracefully before it is killed. So if you need it, set ''​s_vmem''​ to a lower value than ''​h_vmem''​ and implement SIGXCPU handling and cleanup.  
Line 139: | Line 156:  
===== Advanced usage =====| ===== Advanced usage =====  
-| ''​qsub **-q** ​**troja** -**all**.q''​ | +| ''​qsub **-q** ​**cpu** -**troja**.q''​   
-| This way your job is submitted to the Troja queue. The default is ''​**ms** -**all**.q''​. You can also use e.g.| +| This way your job is submitted to the Troja queue. The default is ''​**cpu** -**ms**.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 '​(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 '​*@hector[14]'''​ to submit on **hector1 ​** or hector4,  
''​-q '​[tm]*@!(hector*|iridium)'''​ to submit on any troja/ms machine except hectors and iridium.| ''​-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.| +| However, usually you should specify just the queue (**cpu** -**troja**.q vs. **cpu** -**ms**.q), not a particular machine, and instead use ''​-l''​ to specify the needed resources in a general way.  
''​qsub **-l** ...''​| ''​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).| 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** -**99** ''​ | +| ''​qsub **-p** -**200** ''​   
-| 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 2018, we 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**.| +| 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 2018, we changed the default to -100 (it used to be 0)**. Please, do not use priority between -99 and 0 for jobs taking longer than a few hours, unless it is absolutely necessary for a deadline. In that case, please notify other GPU users. You should ask for lower priority (-1024..-101) if you submit many jobs at once or if the jobs are not urgent**. 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''​  
Line 162: | Line 179:  
''​qsub **-b** y''​| ''​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).| +| 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 **an executable ​** script or a binary ​**(and you must provide full path, e.g. ''​./​script.sh''​)**. 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''​| ''​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.| Specify the emails where you want to be notified when the job has been **b** started, **e** ended, **a** aborted or rescheduled,​ **s** suspended.  
+| The default is now ''​-m a''​ and the default email address is forwarded to you (so there is no need to use ''​-M''​). You can use ''​-m n''​ to override the defaults and send no emails.  
''​qsub **-hold_jid** 121144,​121145''​ (or ''​qsub **-hold_jid** get_src.sh,​get_tgt.sh''​)| ''​qsub **-hold_jid** 121144,​121145''​ (or ''​qsub **-hold_jid** get_src.sh,​get_tgt.sh''​)  
Line 192: | Line 210:  
''​**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 **(both** waiting in the queue **and running**)**. Changeable properties are listed in ''​man qsub''​**.  
''​**man** qsub qstat qalter qhold queue_conf sge_types complex''​| ''​**man** qsub qstat qalter qhold queue_conf sge_types complex''​  
Line 203: | Line 221:  
=== 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!  
+  
+| Don't submit more than ca 5000 jobs with qunhold - it overloads the SGE queue and slows done e.g. ''​qstat''​ (and qunhold uses ''​qstat''​ internally).  
=== sshcwd ===| === sshcwd ===  
Line 236: | Line 256:  
and you execute it now simply with ''​qsub script.sh''​.| and you execute it now simply with ''​qsub script.sh''​.  
+  
+| === ~/​.sge_request ===  
+  
+| You can change the defaults for any option by creating a personal configuration file ''​~/​.sge_request''​. For example, you can add there a line ''​-m n'',​ so you will get no email notifications (unless overridden from the command line or in-script options).  
=== 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''​.  
-|  * ''​-t 1-n''​ start array job with n **jobs** numbered 1 ... n| +|  * ''​-t 1-n''​ start array job with **//** n**// tasks** numbered ​**//** 1 ... n**//**  
* environmental variable ''​SGE_TASK_ID''​|  * environmental variable ''​SGE_TASK_ID''​  
* output and error files ''​$JOB_NAME.[eo]$JOB_ID.$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| +|  * ''​-t m-n[:​s]''​ start array job with **tasks //** m, m + s, ..., n**//**  
* environmental variables ''​SGE_TASK_FIRST,​ SGE_TASK_LAST,​ SGE_TASK_STEPSIZE''​|  * environmental variables ''​SGE_TASK_FIRST,​ SGE_TASK_LAST,​ SGE_TASK_STEPSIZE''​  
-|  * ''​-tc j''​ run at most j **jobs** simultaneously| +|  * ''​-tc j''​ run at most **//** j**// tasks** 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|  * ''​-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  
+  
+| If you use ''​-tc'',​ then SGE can handle array jobs of virtually any size. It only starts as many tasks as specified in ''​-tc''​ at any time, and each scheduling interval (15 seconds in our current configuration) it starts new tasks if less than the specified ''​-tc''​ limit are running. However, note that it means the maximum throughput is //4 * tc// tasks per minute, so the individual array job tasks need to run for at least tens of seconds for this to be effective.  
+  
+| The advantage of array jobs over [[#​qunhold]] is that it does not overload the SGE job queue. Also if you start an array job, the others can see that it is an array job, how many individual tasks there are and how many of them have already finished.  
=== Delete many jobs at once ===| === Delete many jobs at once ===  
Line 254: | Line 282:  
=== Ssh to random sol ===| === Ssh to random sol ===  
Ondřej Bojar suggests to add the following alias to your .bashrc (cf. [[#​sshcwd]]):​| Ondřej Bojar suggests to add the following alias to your .bashrc (cf. [[#​sshcwd]]):​  
-| <​code>​alias cluster='​comp=$((**$** RANDOM ​**/4095** +1)); ssh -o "​StrictHostKeyChecking no" sol$comp'</​code>​| +| <​code>​alias cluster='​comp=$(( ​**(** RANDOM ​**% 10)** +1)); ssh -o "​StrictHostKeyChecking no" sol$comp'</​code>​  
===== Job monitoring =====| ===== Job monitoring =====  
Line 260: | Line 288:  
* ''​qstat [-u user]''​ -- print a list of running/​waiting jobs of a given user|  * ''​qstat [-u user]''​ -- print a list of running/​waiting jobs of a given user  
* ''​qhost''​ -- print available/​total resources|  * ''​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 | +|  ​*** ''​qacct -j job_id''​ -- print info even for ended job (for which ''​qstat -j job_id''​ does not work). See ''​man qacct''​ for more.**  
-|  * ''/​**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| +| **​** * ''/​**opt/LRC** /​REPORTER/​LRC-UFAL/​bin/​lrc_users_real_mem_usage -u user -w''​ -- current memory usage of a given user   
+|  * ''/​**opt/LRC** /​REPORTER/​LRC-UFAL/​bin/​lrc_users_limits_requested -w''​ -- required resources of all users   
+|  * ''/​**opt/LRC** /​REPORTER/​LRC-UFAL/​bin/​lrc_nodes_meminfo''​ -- memory usage of all nodes  
* mem_total:|  * mem_total:  
* mem_free: total memory minus reserved memory (using ''​qsub -l mem_free''​) for each node|  * mem_free: total memory minus reserved memory (using ''​qsub -l mem_free''​) for each node  
* act_mem_free:​ really free memory|  * act_mem_free:​ really free memory  
* mem_used: really used 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) | +|  * ''/​**opt/LRC** /​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 | +|  * ''​cat /**opt/LRC** /​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)| +  
+|  * [[**https** ://ufaladm2**.ufal.hide.ms.mff.cuni.cz** /​munin/​ufal.hide.ms.mff.cuni.cz/​lrc-**master**.ufal.hide.ms.mff.cuni.cz/​index.html|Munin:​ graph of cluster usage by day and user]] and [[**https** ://ufaladm2**.ufal.hide.ms.mff.cuni.cz** /​munin/​ufal.hide.ms.mff.cuni.cz/​**nfs-core**.ufal.hide.ms.mff.cuni.cz/​index.html|Munin monitoring of disk **storage**]] (both accessible only from ÚFAL network)  
+  
+| **===== Profiling =====**  
+| **As stated above, you should always specify the exact memory limits when running your tasks, so that you neither waste RAM nor starve others of memory by using more than you requested. However, memory requirements can be difficult to estimate in advance. That's why you should profile your tasks first.**  
+  
+| **A simple method is to run the task and observe the memory usage reported in the epilog, but SGE may not record transient allocations. As documented in ''​man 5 accounting''​ and observed in ''​qconf -sconf'',​ SGE only collects stats every ''​accounting_flush_time''​. If this is not set, it defaults to ''​flush_time'',​ which is preset to 15 seconds. But the kernel records all info immediately without polling, and you can view these exact stats by looking into /​proc/​$PID/​status while the task is running.**  
+  
+| **You can still miss allocations made shortly before the program exits – which often happens when trying to debug why your program gets killed by SGE after exhausting the reserved space. To record these, use ''/​usr/​bin/​time -v''​ (the actual binary, not the shell-builtin command ''​time''​). Be aware that unlike the builtin, it cannot measure shell functions and behaves differently on pipelines.**  
+  
+| **Obtaining peak usage of multiprocess applications is trickier. Detached and backgrounded processes are ignored completely by ''​time -v''​ and you get the maximum footprint of any children, not the sum of all maximal footprints nor the largest footprint in any instant.**  
+  
+| **If you program in C and need to know the peak memory usage of your children, you can also use the ''​wait4()''​ syscall and calculate the stats yourself.**  
+  
+| **If your job is the only one on a given machine, you can also look how much free memory is left when running the job (e.g. with ''​htop''​ if you know when is the peak moment).**  
===== Other =====| ===== 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).|  * 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.**|  +|  * **Note:​** ​**some** 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]]  
-| **​** * **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]]| +| *** There is a special cluster for Mgr (and Bc) students (but not for PhD and UFAL members): http://​aic.ufal.mff.cuni.cz/​**  
* You can use environment variables ''​$JOB_ID'',​ ''​$JOB_NAME''​.|  * 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).|  * 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:| +|  * 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, **chances ​** 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