Matteo,

In a nutshell, sbatch and salloc allocate resources to the job, while srun 
launches parallel tasks across those resources.  When invoked within a job 
allocation, srun will launch parallel tasks across some or all of the allocated 
resources.  In that case, srun inherits by default the pertinent options of the 
sbatch or salloc which it runs under.  You can then (usually) provide srun 
different options which will override what it receives by default.  Each 
invocation of srun within a job is known as a job step.

srun can also be invoked outside of a job allocation.  In that case, srun 
requests resources, and when those resources are granted, launches tasks across 
those resources as a single job and job step.

There's a relatively new web page which goes into more detail regarding the -B 
and --exclusive options.

doc/html/cpu_management.shtml 

Don

> -----Original Message-----
> From: owner-slurm-...@lists.llnl.gov [mailto:owner-slurm-
> d...@lists.llnl.gov] On Behalf Of Matteo Guglielmi
> Sent: Tuesday, October 18, 2011 4:40 AM
> To: SLURM
> Subject: [slurm-dev] sbatch, srun, salloc: what do they "say" to each
> other?
> 
> Dear All,
> 
> I think slurm is great but I'm still confused on how
> 
> sbatch
> srun
> salloc
> 
> do work "together".
> 
> They seem to have pretty much the same options but
> are these options really identical or do they have
> subtle differences (program dependent)?
> 
> For example, does the "--exclusive" option have a
> different effect/meaning when it is fed to "sbatch"
> rather then "srun"?
> 
> Same holds for -B or other options which are exactly
> the same from the command line point of view.
> 
> I understand that sbatch is used to submit a batch
> script for later execution... but what's the
> "connection" between sbatch and srun when srun is
> called within a batch script?
> 
> Who does what exactly and how are they related to
> each other?
> 
> Should I give the --exclusive, --mem or -B options
> directly to sbatch (outer layer) or to the srun
> command fired up within a batch script (inner layer)?
> 
> How these two layers communicates?
> 
> Is the outer layer (sbatch) just passing over all
> options to srun after having "prepared" something or
> not?
> 
> Or should I consider srun mostly as an independent
> program?
> 
> The concept of partition, job and job step is very
> clear to me... but still I miss who's taking care
> of what.
> 
> I've been through the docs and man pages several
> times but I still miss the "connections" between
> sbatch and srun.
> 
> Can you clarify a bit my confusion?
> 
> As stupid example... -B, --exclusive options... should
> I give them to sbatch, to srun (called within a batch
> script) or to both?
> 
> What's the difference If I give it only to sbatch or
> to the srun command in a batch script?
> 
> Requesting a specific allocation of resources... who
> does it actually and when? Is it sbatch at the very
> same moment it is invoked or srun (later time)... or
> both of them... or none of them actually (slurm plugin)?
> 
> Thanks,
> 
> --matt

Reply via email to