How to Run a Matlab function using .sbatch file

조회 수: 26 (최근 30일)
James Barnes
James Barnes 2018년 4월 19일
답변: Destiny Ellenor 2020년 11월 8일

Hi I am new to slurm and I am trying to run a MATLAB function (I cannot use MDCS because that apparently is not available on one of my available HPC clusters)

I think I am having trouble with understanding the appropriate notation for running a script vs a function using slurm.

These are the two pieces of code that I have seen:

matlab -nodisplay < multi_parfor.m

and...

matlab -nodesktop -r "multi_parfor.m" 

I was wondering if anyone could explain how to do this, and maybe make a comment on the use for each of the above lines of code (is one for a script and one for a function? etc).

Thank you in advance

채택된 답변

Destiny Ellenor
Destiny Ellenor 2020년 11월 8일
You can pass the input arguments for a funtion like this:
srun matlab -nodisplay -singleCompThread -r "FunctionFileName(INPUTArg1,INPUTArg2,INPUTArg3)"
If it is just a script, and not a function, this is how you would write it:
srun matlab -nodisplay -singleCompThread -r "ScriptFileName"
Compute Canada documention has a clear outline on how to write a Slurm submission script to submit a MATLAB job:
And this matlab documentation outlines the syntax/commands of the line above:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Third-Party Cluster Configuration에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by