MATLAB Answers

Matlab parfor on Slurm

79 views (last 30 days)
H H
H H on 3 Apr 2020
Commented: Raymond Norris on 4 Jul 2020
Hi All,
I want to run a parfor on matlab using Slurm job submission on the cluster.
I want to use 15 workers for the parfor. Each worker should calls an external executable program and runs it using a set of distinc parameters. The external program needs 1 CPU(core) for each run.
I know that inside matlab m file I should set the parpool to 15. My question is that which of these two sbach job submission configurations I should to submit the job:
#SBATCH --ntasks=15
#SBATCH --cpus-per-task=1
or
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=15

  3 Comments

Pranav Nadigapu Suresh
Pranav Nadigapu Suresh on 9 Apr 2020
Hi,
Did you find answer to this?
Thanks,
Pranav
H H
H H on 10 Apr 2020
Based on my trials I think option 2 would work. Although in some slurm user webpages they suggested option1, but the job submission was failed when I tried that
Raymond Norris
Raymond Norris on 4 Jul 2020
Hi,
In my experience, I would choose option #2, but keep in mind that the MATLAB client requires a CPU as well, so I would suggest --cpus-per-task=16.
However, you're also saying that each worker will call an external executable. Can the worker an executable it calls run on the same core? If not, perhaps you need 31?
1 (MATLAB) + 15 (workers) + 15 (executable program)
Raymond

Sign in to comment.

Answers (1)

Jason Ross
Jason Ross on 10 Apr 2020
Note that you can specify these options as part of the ResourceTemplate property in the cluster (which would set this for every submission using the profile) or on the cluster object itself (which you could set on a per-job basis) for a Slurm cluster. See the "Slurm" section of the documentation here.
You can also set the Parallel Preferences to request 15 workers by default, or set the number of workers to 15 in the cluster profile.

  0 Comments

Sign in to comment.

Tags

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by