[slurm-users] Define variables within slurm script

Renfro, Michael Renfro at tntech.edu
Mon Feb 18 14:03:05 UTC 2019


If you’re literally putting spaces around the ‘=‘ character, I don’t think that’s valid shell syntax, and should throw errors into your slurm-JOBID.out file when you try it.

See if it works with A=1.0 instead of A = 1.0

> On Feb 18, 2019, at 7:55 AM, Castellana Michele <Michele.Castellana at curie.fr> wrote:
> 
> External Email Warning
> This email originated from outside the university. Please use caution when opening attachments, clicking links, or responding to requests.
> Dear all,
> I would like to use a variable within a slurm script as shown in the following minimal working example. I want to define a variable A, assign a value to it, and run multiple times a code where I use A in a command-line flag: 
> 
> #!/bin/sh
> #SBATCH --job-name=my_job
> #SBATCH —time=01:00:00
> 
> A = 1.0;
> time ./my_code.o -a $A
> 
> A = 2.0;
> time ./my_code.o -a $A
> 
> However, this does not work. Do you know a way around this?
> 
> Best,
> M
> 



More information about the slurm-users mailing list