I need to be submitting multiple SLURM jobs at a time, but all of them need to have some common variables which I would like to be able to pass from the command line. What I have in mind is something like this: A command line input which looks like
bash MasterScript.sh -variable1 var1 -variable2 var2
where MasterScript.sh would be
sbatch JobSubmitter.sh -variable1in var1 -variable2in var2 -version 1
sbatch JobSubmitter.sh -variable1in var1 -variable2in var2 -version 2
sbatch JobSubmitter.sh -variable1in var1 -variable2in var2 -version 3
and then jobsubmitter.sh looks
#!/bin/bash
# Prepare
#SBATCH --partition=devq
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=40
#SBATCH --mem=1g
#SBATCH --time=00:02:00
# Load modules
module purge
module load matlab-uon/r2018b
#
matlab -nodesktop -r "parpool('local',40);MyFun(variable1inin,variable2in,version)";
Right now I have a different SLURM script for each 'version' (there are six), and each time I want to change an input parameter I'm having to edit in all six scripts, and then run them all from a master script which takes no inputs. One of the things which I don't know how to do here is convert input arguments such that they would still show up in the verbatim environment used for the Matlab command.