[slurm-users] Define variables within slurm script

Loris Bennett loris.bennett at fu-berlin.de
Mon Feb 18 14:06:06 UTC 2019


Dear Michele,

Castellana Michele <Michele.Castellana at curie.fr> writes:

> 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?

This has nothing to do with Slurm - it just the syntax of the shell.  It
should be

A=1.0

with no spaces around the equals sign.

Cheers,

Loris

-- 
Dr. Loris Bennett (Mr.)
ZEDAT, Freie Universität Berlin         Email loris.bennett at fu-berlin.de



More information about the slurm-users mailing list