{"id":89,"date":"2020-08-03T17:50:04","date_gmt":"2020-08-03T16:50:04","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/csf4\/?page_id=89"},"modified":"2025-12-08T16:57:15","modified_gmt":"2025-12-08T16:57:15","slug":"srun","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/batch\/srun\/","title":{"rendered":"Interactive Jobs (srun)"},"content":{"rendered":"<p>The following commands will log you in to a compute node for interactive usage:<\/p>\n<pre>\r\n# Serial (1-core) interactive session\r\nsrun --pty bash\r\n\r\n# Multicore (a single compute node) interactive session using several core (e.g., 4 cores)\r\nsrun -p multicore -n 4 --pty bash\r\n\r\n# Note, if running python code that uses 'os.sched_getaffinity(0)' to determine the number\r\n# of available cores, you should use -c rather than -n to specify the number of cores.\r\nsrun -p multicore -c 4 --pty bash\r\n\r\n# To open a GUI app directly use the --x11 flag (can also add -p, -n as above)\r\nsrun --x11 <em>myguiapp<\/em>\r\n\r\n# If running an MPI app via an interactive session, use the following extra flag:\r\nsrun <strong>--mpi=pmi2<\/strong> -n 4 mpirun -n 4 somempiapp.exe\r\n<\/pre>\n<p>Note that by default the above commands will inherit any environment variables you have already loaded on the login node. If you require a clean environment on the compute node (once the <code>srun<\/code> command has logged you in to a compute node) run the following command:<\/p>\n<pre>\r\nmodule purge\r\n<\/pre>\n<p>You can load modulefiles on the compute node as normal using the <code>module load<\/code> command.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following commands will log you in to a compute node for interactive usage: # Serial (1-core) interactive session srun &#8211;pty bash # Multicore (a single compute node) interactive session using several core (e.g., 4 cores) srun -p multicore -n 4 &#8211;pty bash # Note, if running python code that uses &#8216;os.sched_getaffinity(0)&#8217; to determine the number # of available cores, you should use -c rather than -n to specify the number of cores. srun -p.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/batch\/srun\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"parent":31,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-89","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/pages\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/comments?post=89"}],"version-history":[{"count":10,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/pages\/89\/revisions"}],"predecessor-version":[{"id":1476,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/pages\/89\/revisions\/1476"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/pages\/31"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/media?parent=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}