{"id":137968,"date":"2021-12-03T15:35:58","date_gmt":"2021-12-03T20:35:58","guid":{"rendered":"http:\/\/www.bu.edu\/tech\/?page_id=137968"},"modified":"2025-05-09T09:19:19","modified_gmt":"2025-05-09T13:19:19","slug":"interactive-mpi","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/tech\/support\/research\/system-usage\/running-jobs\/interactive-mpi\/","title":{"rendered":"Running MPI jobs in an Interactive Session"},"content":{"rendered":"<p>Usually MPI programs are run by<span>\u00a0<a href=\"https:\/\/www.bu.edu\/tech\/support\/research\/system-usage\/running-jobs\/submitting-jobs\/\"><strong>submitting a batch job<\/strong><\/a><\/span>. However if you want to run MPI jobs interactively, for example to debug or test MPI programs, you can request an interactive session to do that.<\/p>\n<h3 style=\"padding-bottom: 0px; margin-top: 1.5em; margin-bottom: 0.5em;\">How to run MPI jobs in an interactive session<\/h3>\n<p>To start an interactive MPI session, use <span class=\"command\"><span style=\"font-family: Courier New;\" face=\"Courier New\">qrsh<\/span><\/span><span class=\"command\"><span style=\"font-family: Courier New;\" face=\"Courier New\"><\/span><\/span> command with <span class=\"command\"><nobr><span style=\"font-family: Courier New;\" face=\"Courier New\">-pe mpi_X_tasks_per_node Y<\/span><\/nobr><\/span>\u00a0 option, where <span class=\"command\"><span style=\"font-family: Courier New;\" face=\"Courier New\">X<\/span><\/span> is the number of CPU cores per node and\u00a0<span style=\"font-family: Courier New;\">Y<\/span> is the <strong>total<\/strong> number of cores. For example, to request two compute nodes with 28 CPU cores each:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc % <\/span><span class=\"command\">qrsh -pe mpi_28_tasks_per_node 56\r\n<\/span><\/code><\/pre>\n<p>When you submit your interactive job it will wait in the queue until the resources you requested are available. Depending on how busy the SCC is, you may need to wait more than a couple minutes. Interactive jobs by default assume you are only willing to wait for 15 minutes for them to start; if you are willing to wait longer you can use <span class=\"command\"><span style=\"font-family: Courier New;\" face=\"Courier New\">-now n<\/span><\/span><span> <\/span>option to make your job waiting in the queue until the requested resources are available:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc % <\/span><span class=\"command\">qrsh -pe mpi_28_tasks_per_node 56 -now n<\/span><\/code><\/pre>\n<p>In an interactive session, necessary MPI environment variables have been set by the system, so you can run an MPI program with <span class=\"command\"><span style=\"font-family: Courier New;\" face=\"Courier New\">mpirun<\/span><\/span>, simply specifying the total number of MPI tasks with the flag <span class=\"command\"><span style=\"font-family: Courier New;\" face=\"Courier New\">-np<\/span><\/span> (or <span class=\"command\"><span style=\"font-family: Courier New;\" face=\"Courier New\">-n<\/span><\/span>):<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc-ha1 % <\/span><span class=\"command\">mpirun -np 32 .\/your_mpi_binary\r\n<\/span><\/code><\/pre>\n<p>Note that the host file required to run an MPI program on multiple nodes is automatically handled by the system and you do not need to explicitly provide the host file for <span class=\"command\"><span style=\"font-family: Courier New;\" face=\"Courier New\">mpirun<\/span><\/span>.<\/p>\n<p>Please refer to <a title=\"mpi-programming\" href=\"https:\/\/www.bu.edu\/tech\/support\/research\/training-consulting\/online-tutorials\/mpi\/\"><strong>this page<\/strong><\/a> for MPI programming and examples.<\/p>\n<p>For further questions on running MPI jobs in an interactive session, please contact us at <a href=\"mailto:help@scc.bu.edu\">help@scc.bu.edu<\/a> .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Usually MPI programs are run by\u00a0submitting a batch job. However if you want to run MPI jobs interactively, for example to debug or test MPI programs, you can request an interactive session to do that. How to run MPI jobs in an interactive session To start an interactive MPI session, use qrsh command with -pe&#8230;<\/p>\n","protected":false},"author":1692,"featured_media":0,"parent":137962,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/137968"}],"collection":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/users\/1692"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/comments?post=137968"}],"version-history":[{"count":9,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/137968\/revisions"}],"predecessor-version":[{"id":157268,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/137968\/revisions\/157268"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/137962"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/media?parent=137968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}