<div dir="ltr"><div>Hi Chris,</div><div><br></div>Thanks for the tip about the memory units, I'll double check that I'm using them. <div>Is there no way to achieve what I want then? I'd like the first and last job steps to always be able to run, even if the second step needs too many resources (based on the cluster).</div><div><br></div><div>As a side note, do you know why it's not even possible to restrict the number of resources a single step uses (i.e. set less CPUs than are available to the full job)?</div><div><br></div><div>Thanks,</div><div>Maria</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 5, 2020 at 10:27 PM Chris Samuel <<a href="mailto:chris@csamuel.org">chris@csamuel.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tuesday, 5 May 2020 4:47:12 PM PDT Maria Semple wrote:<br>
<br>
> I'd like to set different resource limits for different steps of my job. A<br>
> sample script might look like this (e.g. job.sh):<br>
> <br>
> #!/bin/bash<br>
> srun --cpus-per-task=1 --mem=1 echo "Starting..."<br>
> srun --cpus-per-task=4 --mem=250 --exclusive <do something complicated><br>
> srun --cpus-per-task=1 --mem=1 echo "Finished."<br>
> <br>
> Then I would run the script from the command line using the following<br>
> command: sbatch --ntasks=1 job.sh.<br>
<br>
You shouldn't ask for more resources with "srun" than have been allocated with <br>
"sbatch" - so if you want the job to be able to use up to 4 cores at once & <br>
that amount of memory you'll need to use:<br>
<br>
sbatch -c 4 --mem=250 --ntasks=1 job.sh<br>
<br>
I'd also suggest using suffixes for memory to disambiguate the values.<br>
<br>
All the best,<br>
Chris<br>
-- <br>
  Chris Samuel  :  <a href="http://www.csamuel.org/" rel="noreferrer" target="_blank">http://www.csamuel.org/</a>  :  Berkeley, CA, USA<br>
<br>
<br>
<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Thanks,<br></div>Maria<br></div></div>