Question

I am using slurm sbatch to parralel launch a matlab function on a cluster.

What is the proper syntax in my sbatch file in order to assign numeric parameters to the matlab function?

I have tried the following (and alike s):

#!/bin/bash

#SBATCH --partition=debug
#SBATCH --time=0-00:15:00
#SBATCH --cpus-per-task=12
#SBATCH -n1

VAR1=50
VAR2=40

BASE_MFILE_NAME=RUNAGT
MATLAB_MFILE=.m

  srun --exclusive --cpus-per-task=12 matlab2013b/bin/matlab -nodesktop -nosplash -nodisplay -r "RUNAGT(${SLURM_ARRAY_TASK_ID},VAR1,VAR2);exit" -logfile testV${SLURM_ARRAY_TASK_ID}.log &
wait

${SLURM_ARRAY_TASK_ID} is working but matlab does not recognize VAR1 and VAR2.

error: Undefined function or variable 'VAR1'.

Was it helpful?

Solution

I believe it is not reading your variables because you are not putting a $ in front of them. You srun line should be:

srun --exclusive --cpus-per-task=12 matlab2013b/bin/matlab -nodesktop -nosplash -nodisplay -r "RUNAGT(${SLURM_ARRAY_TASK_ID},${VAR1},${VAR2});exit" -logfile testV${SLURM_ARRAY_TASK_ID}.log &
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top