{"id":584,"date":"2020-05-13T15:43:00","date_gmt":"2020-05-13T13:43:00","guid":{"rendered":"http:\/\/calculs.univ-cotedazur.fr\/?page_id=584"},"modified":"2025-04-25T11:35:46","modified_gmt":"2025-04-25T09:35:46","slug":"openmpi","status":"publish","type":"page","link":"https:\/\/calculs.univ-cotedazur.fr\/?page_id=584&lang=en","title":{"rendered":"MPI"},"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-3\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/calculs.univ-cotedazur.fr\/?page_id=584&amp;lang=en#OpenMPI\" title=\"OpenMPI\">OpenMPI<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/calculs.univ-cotedazur.fr\/?page_id=584&amp;lang=en#Intel_MPI\" title=\"Intel MPI\">Intel MPI<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"OpenMPI\"><\/span>OpenMPI<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you submit your jobs with sbatch and your job loads an OpenMPI module, you can issue your <em>mpirun <\/em>commands without an option describing the resources to be used (such as -np, -H, -npersocket, etc.). OpenMPI has indeed been configured to retrieve this information directly from Slurm.<\/p>\n\n\n\n<p>In order to optimize the performance of your jobs, it is therefore advisable to configure the options for booking resources with Slurm. If you do not give a sufficiently precise definition of the reserved resources, your tasks may be dispatched to different nodes (via the queue <em>cpucourt<\/em> and if the cluster is widely used) and therefore you will lose performance. It is therefore recommended to use options that specify the reservation, such as:<\/p>\n\n\n\n<pre class=\"wp-block-verse\">--nodes=1  <br>--ntasks=4<br>--ntasks-per-node=4 <br>--ntasks-per-socket=4 <\/pre>\n\n\n\n<p>Here, we reserve 4 cores on the same node and the same processor. For information, the computation nodes (queues <em>cpucourt <\/em>and <em>cpulong<\/em>) are equipped with 2 processors (socket), each having 20 cores.<\/p>\n\n\n\n<p>Here is an example of a job declaration with Slurm where the code will run on 2 nodes (with 10 cores used on each socket):<\/p>\n\n\n\n<pre class=\"wp-block-verse\">#!\/bin\/bash\n#SBATCH --job-name=check_mpi\n#SBATCH --output=check_mpi.txt\n\n#SBATCH --time=10:00\n#SBATCH --account=project_name\n\n#SBATCH --ntasks=40 \n#SBATCH --ntasks-per-node=20\n#SBATCH --nodes=2\n#SBATCH --ntasks-per-socket=10\n\nmodule purge\nmodule load openmpi\/4.1.7\n\nmpirun program.mpi<\/pre>\n\n\n\n<h3><span class=\"ez-toc-section\" id=\"Intel_MPI\"><\/span>Intel MPI<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Job example:<\/p>\n\n\n\n<pre class=\"wp-block-verse\">#!\/bin\/bash\n#SBATCH --job-name=test_mpi\n#SBATCH --output=mpi.txt\n#SBATCH --ntasks=4\n#SBATCH --time=10:00\n#SBATCH --account=projectname\n#SBATCH --constraint=intel\n\nmodule purge\nmodule load intel\/2020-cluster-xe\n\nmpirun -bootstrap slurm -n $SLURM_NTASKS \/home\/username\/jobs\/my_code.mpi<\/pre>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\"Cliquez ici (s\u2019ouvre dans un nouvel onglet)\" href=\"https:\/\/software.intel.com\/content\/www\/us\/en\/develop\/documentation\/mpi-developer-reference-linux\/top.html\" target=\"_blank\">Click here<\/a> to read the official Intel MPI documentation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenMPI If you submit your jobs with sbatch and your job loads an OpenMPI module, you can issue your mpirun commands without an option describing the resources to be used (such as -np, -H, -npersocket, etc.). OpenMPI has indeed been &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\/584"}],"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=584"}],"version-history":[{"count":11,"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=\/wp\/v2\/pages\/584\/revisions"}],"predecessor-version":[{"id":3000,"href":"https:\/\/calculs.univ-cotedazur.fr\/index.php?rest_route=\/wp\/v2\/pages\/584\/revisions\/3000"}],"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=584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}