landau
landau

Reputation: 5841

Setting sbatch environment variables with srun

In a blog post by Pierre Lindenbaum, srun is called within a Makefile to run jobs. I rely on this technique, but it makes no use of sbatch at all, so I am missing the chance to set sbatch-like environment variables. Where can I put the following so SLURM knows what to do?

#SBATCH -J testing
#SBATCH -A account
#SBATCH --time=1:00:00
#SBATCH --cpus-per-task=1
#SBATCH --begin=now
#SBATCH --mem=1G
#SBATCH -C sb

Upvotes: 2

Views: 1723

Answers (1)

damienfrancois
damienfrancois

Reputation: 59180

The srun command accepts nearly all of the sbatch parameters (with the notable exception of --array). In the referred blog post, these arguments are set at the line:

.SHELLFLAGS= -N1 -n1  bash -c 

so you would write

.SHELLFLAGS= -J testing  -A account  --time=1:00:00 --cpus-per-task --begin=now --mem=1G -C sb bash -c 

Note that if you specify --cpu-per-task=1, and you keep the default of one tasks, it probably means that nodes are shared in your setup ; in that case, --mem-per-cpu=1G makes more sense than --mem=1G

Upvotes: 2

Related Questions