<div dir="ltr"><div class="gmail_default" style="font-family:monospace">The position of the #SBATCH directives also matters (emphasis mine):</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">> The batch script may contain options preceded with "#SBATCH" <b>before any executable commands</b> in the script.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">We've been bit by that a couple times- a stray command before any #SBATCH lines will cause any of those directives to be ignored.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"> - Michael</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 8, 2023 at 11:41 PM Bjørn-Helge Mevik <<a href="mailto:b.h.mevik@usit.uio.no">b.h.mevik@usit.uio.no</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">"Bunis, Dan" <<a href="mailto:Daniel.Bunis@ucsf.edu" target="_blank">Daniel.Bunis@ucsf.edu</a>> writes:<br>
<br>
> My colleagues and I have noticed that our compute cluster seems to<br>
> ignore '--partition' requests when we give them as '#SBATCH<br>
> --partition=<partition_name>' inside of our scripts, but it respects<br>
> them when given in-line within our sbatch calls as 'sbatch<br>
> --partition=<partition_name> script.sh'.  Based on some googling, it<br>
> seems that both methods are meant to work, so I'm wondering if it's<br>
> known what can cause the in-script methodology to NOT work for<br>
> schedulers where the in-line methodology DOES work?<br>
<br>
My suspicion is that there is an environment variable SBATCH_PARTITION<br>
set in your shells.  Such a variable will override the #SBATCH directive,<br>
but not the command line switch.<br>
<br>
>From man sbatch:<br>
<br>
INPUT ENVIRONMENT VARIABLES<br>
[...]<br>
    NOTE: Environment variables will override any options set in a batch<br>
    script, and command line options will override any environment<br>
    variables.<br>
<br>
-- <br>
Regards,<br>
Bjørn-Helge Mevik, dr. scient,<br>
Department for Research Computing, University of Oslo<br>
<br>
</blockquote></div>