{"id":248,"date":"2016-01-29T09:44:10","date_gmt":"2016-01-29T09:44:10","guid":{"rendered":"https:\/\/portal.supercomputing.wales\/?page_id=248"},"modified":"2018-06-28T17:36:36","modified_gmt":"2018-06-28T16:36:36","slug":"interactive-use","status":"publish","type":"page","link":"https:\/\/portal.supercomputing.wales\/index.php\/index\/slurm\/interactive-use-job-arrays\/interactive-use\/","title":{"rendered":"Interactive Use"},"content":{"rendered":"<p>In order to use an HPC system interactively &#8211; i.e. whilst sat in front of the terminal interacting live with allocated resources &#8211; there is a simple two stage process in Slurm.<\/p>\n<p>Firstly, we must create an allocation &#8211; that is, an allocation of a certain amount of resources that we specify we need. This is done using the <em>salloc<\/em> command, like this:<br \/>\n<pre class=\"preserve-code-formatting\">[test.user@cl1 imb]$ salloc -n 8 --ntasks-per-node=1\n salloc: Granted job allocation 134<\/pre><br \/>\nNow that an allocation has been granted, we have access to those specified resources. Note that the resource specification we made in this case is exactly as the parameters passed for batch use was &#8211; so in this case we have asked for 8 tasks (processes) with them distributed at one per node.<\/p>\n<p>Now that we are &#8216;inside&#8217; an allocation, we can use the <em>srun<\/em> command to execute against the allocated resources, for example:<br \/>\n<pre class=\"preserve-code-formatting\">[test.user@cl1 imb]$ srun hostname\nccs0129\nccs0130\nccs0126\nccs0133\nccs0125\nccs0121\nccs0134\nccs0122<\/pre><br \/>\nThe above output shows how, by default, <em>srun<\/em> executes a command on all allocated processors. Arguments can be passed to <em>srun<\/em> to operate differently, for example:<\/p>\n<p>We could also launch an MPI job here if we wished. We would load the software <em>modules<\/em> as we do in a batch script and call <em>mpirun<\/em> in the same way. This can be useful during code debugging.<\/p>\n<p>It is also possible to use <em>srun<\/em> to launch an interactive shell process for some heavy processing on a compute node, for example:<br \/>\n<pre class=\"preserve-code-formatting\">srun -n 2 --pty bash<\/pre><br \/>\nThis would move us to a shell on a compute node.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to use an HPC system interactively &#8211; i.e. whilst sat in front of the terminal interacting live with allocated resources &#8211; there is a simple two stage process in Slurm. Firstly, we must create an allocation &#8211; that is, an allocation of a certain amount of resources that we specify we need. This [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":42,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page-nosidebar.php","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"class_list":["post-248","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/portal.supercomputing.wales\/index.php\/wp-json\/wp\/v2\/pages\/248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/portal.supercomputing.wales\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/portal.supercomputing.wales\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/portal.supercomputing.wales\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/portal.supercomputing.wales\/index.php\/wp-json\/wp\/v2\/comments?post=248"}],"version-history":[{"count":3,"href":"https:\/\/portal.supercomputing.wales\/index.php\/wp-json\/wp\/v2\/pages\/248\/revisions"}],"predecessor-version":[{"id":594,"href":"https:\/\/portal.supercomputing.wales\/index.php\/wp-json\/wp\/v2\/pages\/248\/revisions\/594"}],"up":[{"embeddable":true,"href":"https:\/\/portal.supercomputing.wales\/index.php\/wp-json\/wp\/v2\/pages\/42"}],"wp:attachment":[{"href":"https:\/\/portal.supercomputing.wales\/index.php\/wp-json\/wp\/v2\/media?parent=248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}