<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="en-AT" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">This line also has tobe changed:
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><br>
</span><span style="color:black;background:white">#SBATCH --gpus-per-node=4</span><span style="color:black;background:white">
</span><span lang="EN-US" style="font-family:Wingdings;color:black;background:white"></span><span lang="EN-US" style="color:black;background:white">
</span><span style="color:black;background:white">#SBATCH --gpus-per-node=</span><span lang="EN-US" style="color:black;background:white">1<br>
<br>
</span><span style="color:black;background:white">--gpus-per-node</span><span lang="EN-US" style="color:black;background:white"> seems to be the new parameter that is replacing the
</span><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"> </span><span lang="EN-US" style="font-size:11.0pt">--gres= one, so you can remove the –gres line completely.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Best<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Ümit<br>
<br>
</span><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span lang="FR" style="color:black">From:
</span></b><span lang="FR" style="color:black">slurm-users <slurm-users-bounces@lists.schedmd.com> on behalf of Kherfani, Hafedh (Professional Services, TC) <hafedh.kherfani@hpe.com><br>
<b>Date: </b>Thursday, 18. January 2024 at 15:40<br>
<b>To: </b>Slurm User Community List <slurm-users@lists.schedmd.com><br>
<b>Subject: </b>Re: [slurm-users] Need help with running multiple instances/executions of a batch script in parallel (with NVIDIA HGX A100 GPU as a Gres)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="FR" style="font-size:11.0pt">Hi Noam and Matthias,</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="font-size:11.0pt"> </span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Thanks both for your answers.</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">I changed the “#SBATCH --gres=gpu:4“ directive (in the batch script) with “#SBATCH --gres=gpu:1“ as you suggested, but it didn’t make a difference, as running this batch script 3 times will result
in the first job to be in a running state, while the second and third jobs will still be in a pending state …
</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">[slurmtest@c-a100-master test-batch-scripts]$ cat gpu-job.sh</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">#!/bin/bash</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">#SBATCH --job-name=gpu-job</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">#SBATCH --partition=gpu</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">#SBATCH --nodes=1</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">#SBATCH --gpus-per-node=4</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">#SBATCH --gres=gpu:1 # <<<< Changed from ‘4’ to ‘1’
</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">#SBATCH --tasks-per-node=1</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">#SBATCH --output=gpu_job_output.%j
</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">#SBATCH --error=gpu_job_error.%j
</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">hostname</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">date</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">sleep 40</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">pwd</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">[slurmtest@c-a100-master test-batch-scripts]$ sbatch gpu-job.sh</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Submitted batch job
<b>217</b></span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">[slurmtest@c-a100-master test-batch-scripts]$ squeue</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> 217 gpu gpu-job slurmtes R 0:02 1 c-a100-cn01</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">[slurmtest@c-a100-master test-batch-scripts]$ sbatch gpu-job.sh</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Submitted batch job
<b>218</b></span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">[slurmtest@c-a100-master test-batch-scripts]$ sbatch gpu-job.sh</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Submitted batch job
<b>219</b></span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">[slurmtest@c-a100-master test-batch-scripts]$ squeue</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> 219 gpu gpu-job slurmtes
<b>PD</b> 0:00 1 (Priority)</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> 218 gpu gpu-job slurmtes
<b>PD</b> 0:00 1 (Resources)</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> 217 gpu gpu-job slurmtes
<b>R</b> 0:07 1 c-a100-cn01</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Basically I’m seeking for some help/hints on how to tell Slurm, from the batch script for example: “I want only 1 or 2 GPUs to be used/consumed by the job”, and then I run the batch script/job
a couple of times with sbatch command, and confirm that we can indeed have multiple jobs using a GPU and running in parallel, at the same time.
</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Makes sense ? </span>
<span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="FR"><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">Best regards,</span><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal" style="page-break-after:avoid"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black"> </span></b><span lang="FR"><o:p></o:p></span></p>
<p class="MsoNormal" style="page-break-after:avoid"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">Hafedh
</span></b><span lang="FR"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="FR"> <o:p></o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> slurm-users <slurm-users-bounces@lists.schedmd.com>
<b>On Behalf Of </b>Bernstein, Noam CIV USN NRL (6393) Washington DC (USA)<br>
<b>Sent:</b> jeudi 18 janvier 2024 2:30 PM<br>
<b>To:</b> Slurm User Community List <slurm-users@lists.schedmd.com><br>
<b>Subject:</b> Re: [slurm-users] Need help with running multiple instances/executions of a batch script in parallel (with NVIDIA HGX A100 GPU as a Gres)</span><span lang="FR"><o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="FR"> <o:p></o:p></span></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span lang="FR">On Jan 18, 2024, at 7:31 AM, Matthias Loose <<a href="mailto:m.loose@mindcode.de">m.loose@mindcode.de</a>> wrote:<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="FR"> <o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="FR">Hi Hafedh,<br>
<br>
Im no expert in the GPU side of SLURM, but looking at you current configuration to me its working as intended at the moment. You have defined 4 GPUs and start multiple jobs each consuming 4 GPUs each. So the jobs wait for the ressource the be free again.<br>
<br>
I think what you need to look into is the MPS plugin, which seems to do what you are trying to achieve:<br>
<a href="https://slurm.schedmd.com/gres.html#MPS_Management">https://slurm.schedmd.com/gres.html#MPS_Management</a><o:p></o:p></span></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><span lang="FR"> <o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="FR">I agree with the first paragraph. How many GPUs are you expecting each job to use? I'd have assumed, based on the original text, that each job is supposed to use 1 GPU, and the 4 jobs were supposed to be running side-by-side
on the one node you have (with 4 GPUs). If so, you need to tell each job to request only 1 GPU, and currently each one is requesting 4.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="FR"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="FR">If your jobs are actually supposed to be using 4 GPUs each, I still don't see any advantage to MPS (at least in what is my usual GPU usage pattern): all the jobs will take longer to finish, because they are sharing the fixed
resource. If they take turns, at least the first ones finish as fast as they can, and the last one will finish no later than it would have if they were all time-sharing the GPUs. I guess NVIDIA had something in mind when they developed MPS, so I guess our
pattern may not be typical (or at least not universal), and in that case the MPS plugin may well be what you need.<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>