{"id":628,"date":"2020-05-18T16:42:01","date_gmt":"2020-05-18T14:42:01","guid":{"rendered":"http:\/\/calculs.univ-cotedazur.fr\/?page_id=628"},"modified":"2021-03-02T16:31:08","modified_gmt":"2021-03-02T15:31:08","slug":"how-to-evaluate-the-right-amount-of-memory-and-walltime","status":"publish","type":"page","link":"https:\/\/calculs.univ-cotedazur.fr\/?page_id=628&lang=en","title":{"rendered":"How to estimate the resources required to run your job"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_11 counter-hierarchy counter-decimal ez-toc-grey\">\n<nav><ul class=\"ez-toc-list ez-toc-list-level-1\"><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/calculs.univ-cotedazur.fr\/?page_id=628&amp;lang=en#Avoid_unnecessary_resources_reservation\" title=\"Avoid unnecessary resources reservation\">Avoid unnecessary resources reservation<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/calculs.univ-cotedazur.fr\/?page_id=628&amp;lang=en#How_to_set_the_amount_of_memory_to_be_reserved\" title=\"How to set the amount of memory to be reserved\">How to set the amount of memory to be reserved<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/calculs.univ-cotedazur.fr\/?page_id=628&amp;lang=en#I_increased_the_number_of_cores_but_performance_fails_to_improve\" title=\"I increased the number of cores but performance fails to improve\">I increased the number of cores but performance fails to improve<\/a><\/li><\/ul><\/nav><\/div>\n<h4><span class=\"ez-toc-section\" id=\"Avoid_unnecessary_resources_reservation\"><\/span>Avoid unnecessary resources reservation<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Some commands can help you define an adequate reservation of resources (cores, memory and walltime). The interest is that if few resources are available on the cluster, a job that needs few resources is likely to be run sooner than a job requiring many resources. Moreover, as your project is being allocated a given volume of CPU hours per year, this allows you to become aware if you are wasting resources. <\/p>\n\n\n\n<p>You can use the \u00ab&nbsp;Slurm job efficiency report&nbsp;\u00bb (seff) that reports on the efficiency of a job&rsquo;s CPU and memory utilization. Just launch the command below, once the first execution of the job is complete: <\/p>\n\n\n\n<pre class=\"wp-block-verse\">seff &lt;JOBID&gt;<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"553\" height=\"240\" src=\"http:\/\/calculs.univ-cotedazur.fr\/wp-content\/uploads\/2020\/05\/seff.png\" alt=\"\" class=\"wp-image-666\" srcset=\"https:\/\/calculs.univ-cotedazur.fr\/wp-content\/uploads\/2020\/05\/seff.png 553w, https:\/\/calculs.univ-cotedazur.fr\/wp-content\/uploads\/2020\/05\/seff-300x130.png 300w\" sizes=\"(max-width: 553px) 100vw, 553px\" \/><figcaption>This job made a reservation for 2 nodes whereas one node would have been enough (CPU Efficiency lower than 50%) <\/figcaption><\/figure>\n\n\n\n<p>The following command will allow you to see what was the memory consumption and the time elapsed for each stage of the job. Thus, you can readjust these parameters for your next executions. <\/p>\n\n\n\n<pre>sacct -j &lt;JOBID&gt; --format=jobid,jobname,reqnodes,reqcpus,reqmem,maxrss,averss,elapsed,TotalCPU<\/pre>\n\n\n\n<p>If you want to see the information for all your jobs, use this command:<\/p>\n\n\n\n<pre>sacct -S &lt;START_DATE&gt; --format=jobid,jobname,reqnodes,reqcpus,reqmem,maxrss,averss,elapsed,cputime,time,start,end -u &lt;USERNAME&gt;<\/pre>\n\n\n\n<p>The complete list of columns that can be shown <a href=\"https:\/\/slurm.schedmd.com\/sacct.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"is available here. (s\u2019ouvre dans un nouvel onglet)\">is available here.<\/a><\/p>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"How_to_set_the_amount_of_memory_to_be_reserved\"><\/span>How to set the amount of memory to be reserved<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>To set the amount of memory necessary for your job, the Slurm options available to you are as follows:<\/p>\n\n\n\n<pre class=\"wp-block-verse\">--mem=<br>--mem-per-cpu=<br>--mem-per-gpu=<\/pre>\n\n\n\n<p>By default, the specified value is considered to be in Megabytes, but you can change the unit of measurement by adding after it [K|M|G|T].<\/p>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"I_increased_the_number_of_cores_but_performance_fails_to_improve\"><\/span>I increased the number of cores but performance fails to improve<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Although a parallel code execution can save significant time compared to  execution on a single core, you may notice that the speed of your code  execution does not increase in proportion to the number of IT resources  used. Indeed, the sequential (= non-parallelizable) portions of your  code are not sensitive to the increase in the number of cores. Thus,  depending on your code, from a certain number of resources the execution  acceleration will reach its maximum threshold and it will therefore be  useless to run this code on more resources. For more information on this  subject, <a rel=\"noreferrer noopener\" href=\"https:\/\/en.wikipedia.org\/wiki\/Amdahl%27s_law\" target=\"_blank\">see Amdahl&rsquo;s law.<\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Avoid unnecessary resources reservation Some commands can help you define an adequate reservation of resources (cores, memory and walltime). The interest is that if few resources are available on the cluster, a job that needs few resources is likely to &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":580,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=\/wp\/v2\/pages\/628"}],"collection":[{"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=628"}],"version-history":[{"count":9,"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=\/wp\/v2\/pages\/628\/revisions"}],"predecessor-version":[{"id":1198,"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=\/wp\/v2\/pages\/628\/revisions\/1198"}],"up":[{"embeddable":true,"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=\/wp\/v2\/pages\/580"}],"wp:attachment":[{"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}