How to pass variables in an sbatch script for multiple job sumissions

故事扮演 提交于 2019-12-11 17:24:08

问题


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.

来源:https://stackoverflow.com/questions/57009053/how-to-pass-variables-in-an-sbatch-script-for-multiple-job-sumissions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!