{"id":9158,"date":"2025-03-18T16:31:38","date_gmt":"2025-03-18T16:31:38","guid":{"rendered":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/?page_id=9158"},"modified":"2026-02-20T12:24:03","modified_gmt":"2026-02-20T12:24:03","slug":"srun","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/batch-slurm\/srun\/","title":{"rendered":"Interactive Jobs (srun, srun-x11)"},"content":{"rendered":"<p>The following commands will log you in to a compute node for interactive usage.<\/p>\n<div class=\"hint\">\nYou <strong>must<\/strong> specify a <a href=\"..\/partitions\">partition<\/a> name and a <a href=\"..\/timelimits-slurm\">wallclock time limit<\/a>.<\/p>\n<p><strong>Feb 2026 update<\/strong>: The maximum wallclock in the interactive partition is now 6 hours (up from 1 hour).\n<\/div>\n<h2>Starting an Interactive Session<\/h2>\n<p>Please note that the maximum wallclock time for interactive jobs is 6 hours. You <em>must<\/em> specify the wallclock time limit for your interactive session!<\/p>\n<h3>Command-line apps<\/h3>\n<p>The <code>srun<\/code> command should be run on the login node:<\/p>\n<p>Serial (1-core) interactive session on AMD Genoa lasting 2 hours (0 days, 2 hours)<\/p>\n<pre>srun -p interactive -t 0-2 --pty bash<\/pre>\n<p>Multicore interactive session on AMD Genoa lasting 2 hours (0 days, 2 hours). Use the <code>-n<\/code> flag if running MPI applications. The <code>$SLURM_NTASKS<\/code> environment variable will be set to the number of cores requested.<\/p>\n<pre>srun -p interactive -n 4 -t 0-2 --pty bash<\/pre>\n<p>Note, if running OpenMP code or python code that uses <code>os.sched_getaffinity(0)<\/code> to determine the number of available cores, you should use <code>-c<\/code> rather than <code>-n<\/code> to specify the number of cores. The <code>$SLURM_CPUS_PER_TASK<\/code> environment variable will be set to the number of cores requested.<\/p>\n<pre>srun -p interactive <strong>-c 4<\/strong> -t 0-2 --pty bash<\/pre>\n<p>Also note, that if you need to run an interactive session on <strong>Intel<\/strong> CPUs, then you also have the option to use the serial partition by typing:<\/p>\n<pre>srun -p serial -t 0-2 --pty bash<\/pre>\n<p>To return to the login node<\/p>\n<pre>exit 0<\/pre>\n<p>If you receive an error containing the message:<\/p>\n<pre>\r\n# Error when trying to open a GUI app\r\nERROR: cannot open display:\r\n\r\n# Return to the login node\r\nexit\r\n<\/pre>\n<p>then you should try <code>srun-x11<\/code> below instead of <code>srun<\/code>.<\/p>\n<h3>GUI apps<\/h3>\n<p>The <code>srun-x11<\/code> command should be run on the login node to allow GUI apps to be run on the compute node and have them display on your screen. Note that this is NO <code>--pty bash<\/code> used with this command:<br \/>\nSerial (1-core) interactive session on AMD Genoa with remote display, lasting 2 hours (0 days, 2 hours):<\/p>\n<pre>srun-x11 -p interactive -t 0-2             # NO '--pty bash' required<\/pre>\n<p>Multicore interactive session on AMD Genoa with remote display, lasting 2 hours (0 days, 2 hours):<\/p>\n<pre>srun-x11 -p interactive -n 4 -t 0-2        # NO '--pty bash' required<\/pre>\n<p>Example: Now do the following to open the <a href=\"\/csf3\/software\/tools\/xnedit\">xnedit<\/a> text editor on the node<\/p>\n<pre>\r\nmodule load apps\/binapps\/xnedit\r\nxnedit\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.<\/p>\n<p>If you require a clean environment on the compute node (once the <code>srun<\/code>\/<code>srun-x11<\/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<p>When finished with your session, return to the login node using:<\/p>\n<pre>\r\nexit 0\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The following commands will log you in to a compute node for interactive usage. You must specify a partition name and a wallclock time limit. Feb 2026 update: The maximum wallclock in the interactive partition is now 6 hours (up from 1 hour). Starting an Interactive Session Please note that the maximum wallclock time for interactive jobs is 6 hours. You must specify the wallclock time limit for your interactive session! Command-line apps The srun.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/batch-slurm\/srun\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":9105,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-9158","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/comments?post=9158"}],"version-history":[{"count":20,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9158\/revisions"}],"predecessor-version":[{"id":11898,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9158\/revisions\/11898"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9105"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/media?parent=9158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}