[slurm-users] Job Step Resource Requests are Ignored

Chris Samuel chris at csamuel.org
Wed May 6 05:27:20 UTC 2020

On Tuesday, 5 May 2020 4:47:12 PM PDT Maria Semple wrote:

> I'd like to set different resource limits for different steps of my job. A
> sample script might look like this (e.g. job.sh):
> #!/bin/bash
> srun --cpus-per-task=1 --mem=1 echo "Starting..."
> srun --cpus-per-task=4 --mem=250 --exclusive <do something complicated>
> srun --cpus-per-task=1 --mem=1 echo "Finished."
> Then I would run the script from the command line using the following
> command: sbatch --ntasks=1 job.sh.

You shouldn't ask for more resources with "srun" than have been allocated with 
"sbatch" - so if you want the job to be able to use up to 4 cores at once & 
that amount of memory you'll need to use:

sbatch -c 4 --mem=250 --ntasks=1 job.sh

I'd also suggest using suffixes for memory to disambiguate the values.

All the best,
  Chris Samuel  :  http://www.csamuel.org/  :  Berkeley, CA, USA

More information about the slurm-users mailing list