MATLAB: Difference between revisions

Jump to navigation Jump to search
31 bytes removed ,  4 years ago
no edit summary
No edit summary
No edit summary
Line 212: Line 212:


= Using the MATLAB Parallel Server = <!--T:41-->
= Using the MATLAB Parallel Server = <!--T:41-->
MATLAB Distributed Computing Server (MDCS) became MATLAB Parallel Server in the recent years. This technology is only worthwhile if you need more workers in your parallel MATLAB job than available CPU cores on a single compute node. While the regular MATLAB installation (see above sections) allows you to run parallel jobs within one node (up to 64, depending on which node and cluster), the MATLAB Parallel Server is the licensed MathWorks solution for running a parallel job on more than one node. For the moment, the use of the MATLAB Parallel Server is only supported on the [[Béluga/en | Béluga]] cluster.
MATLAB Distributed Computing Server (MDCS) became MATLAB Parallel Server in the recent years. This technology is only worthwhile if you need more workers in your parallel MATLAB job than available CPU cores on a single compute node. While the regular MATLAB installation (see above sections) allows you to run parallel jobs within one node (up to 64 jobs per node, depending on which node and cluster), the MATLAB Parallel Server is the licensed MathWorks solution for running a parallel job on more than one node. For the moment, the use of the MATLAB Parallel Server is only supported on the [[Béluga/en | Béluga]] cluster.


<!--T:42-->
<!--T:42-->
This solution allows the submission of MATLAB parallel jobs from a local MATLAB interface on your computer. Some configuration is required in order to submit jobs remotely to the Slurm scheduler. Please follow instructions in all sections below.
This solution allows the submission of MATLAB parallel jobs from a local MATLAB interface on your computer. Some configuration is required in order to submit jobs remotely to the Slurm scheduler. Please follow instructions in the sections below.


== Slurm plugin for MATLAB == <!--T:43-->
== Slurm plugin for MATLAB == <!--T:43-->
# Have MATLAB R2020a installed on your computer, '''including the Parallel Computing Toolbox'''.
# Have MATLAB R2020a installed on your computer, '''including the Parallel Computing Toolbox'''.
# Go to the [https://www.mathworks.com/matlabcentral/fileexchange/52807-parallel-computing-toolbox-plugin-for-matlab-parallel-server-with-slurm MathWorks Slurm Plugin page], '''download and run''' the <tt>*.mlpkginstall</tt> file. (i.e. click on the blue "Download" button on the right side, just above the "Overview" section.)
# Go to the [https://www.mathworks.com/matlabcentral/fileexchange/52807-parallel-computing-toolbox-plugin-for-matlab-parallel-server-with-slurm MathWorks Slurm Plugin page], '''download and run''' the <tt>*.mlpkginstall</tt> file. (i.e. click on the blue ''Download'' button on the right side, just above the ''Overview'' tab.)
: The installer file will start MATLAB and start the installation process.
# Enter your MathWorks credentials; if the configuration wizard does not start, run in MATLAB
# Enter your MathWorks credentials.
#:<tt>parallel.cluster.generic.runProfileWizard()</tt>
* The configuration wizard will then start.  If it does not start, run in MATLAB: <tt>parallel.cluster.generic.runProfileWizard()</tt>.
# Give these responses to the configuration wizard:
# Give these responses to the configuration wizard:
** Select '''Unix''' (which is usually the only choice).
#* Select '''Unix''' (which is usually the only choice)
** Shared location: '''No'''  
#* Shared location: '''No'''  
** Cluster host: '''beluga.computecanada.ca'''
#* Cluster host: '''beluga.computecanada.ca'''
** Username (optional): Enter your Compute Canada username (the identity file can be set later, if needed).
#* Username (optional): Enter your Compute Canada username (the identity file can be set later, if needed)
** Remote job storage: '''/scratch'''  (or a unique sub-directory, for example /scratch/tmp_matlab).
#* Remote job storage: '''/scratch'''  (or a unique sub-directory, for example /scratch/tmp_matlab)
** Maximum number of workers: '''960'''
#* Maximum number of workers: '''960'''
** Matlab installation: '''/cvmfs/restricted.computecanada.ca/easybuild/software/2017/Core/matlab/2020a'''
#* Matlab installation: '''/cvmfs/restricted.computecanada.ca/easybuild/software/2017/Core/matlab/2020a'''
** License type: '''Network license manager'''
#* License type: '''Network license manager'''
** Profile Name: '''beluga'''
#* Profile Name: '''beluga'''
# Create and finalize the profile.
# Click on ''Create'' and ''Finish'' to finalize the profile.


== Edit the plugin once installed == <!--T:44-->
== Edit the plugin once installed == <!--T:44-->
# In MATLAB, go to the <tt>nonshared</tt> folder:
# In MATLAB, go to the <tt>nonshared</tt> folder:
cd(fullfile(matlabshared.supportpkg.getSupportPackageRoot, 'parallel', 'slurm', 'nonshared'))
#:{{Command|cd(fullfile(matlabshared.supportpkg.getSupportPackageRoot, 'parallel', 'slurm', 'nonshared'))}}
 
# Open the <tt>independentSubmitFcn.m</tt> file; around line #97 is the line <p> <tt>additionalSubmitArgs = sprintf('--ntasks=1 --cpus-per-task=%d', cluster.NumThreads);</tt> </p><p> Replace this line with</p><p> <tt>additionalSubmitArgs = ccSBATCH().getSubmitArgs();</tt></p>
<!--T:45-->
# Restart MATLAB and go back to your home directory:
# Open the <tt>independentSubmitFcn.m</tt> file; around line #97 is the line  
:{{Command|cd(getenv('HOME'))}}
additionalSubmitArgs = sprintf('--ntasks=1 --cpus-per-task=%d', cluster.NumThreads);
: Replace this line with
additionalSubmitArgs = ccSBATCH().getSubmitArgs();
 
<!--T:46-->
# Then, restart MATLAB, and go back to your home directory:
cd(getenv('HOME'))


== Validation == <!--T:47-->
== Validation == <!--T:47-->
Line 253: Line 245:
# Download and extract code samples on GitHub at https://github.com/ComputeCanada/matlab-parallel-server-samples.
# Download and extract code samples on GitHub at https://github.com/ComputeCanada/matlab-parallel-server-samples.
# In MATLAB, go to the newly extracted <tt>TestParfor</tt> directory.
# In MATLAB, go to the newly extracted <tt>TestParfor</tt> directory.
# Follow instructions in https://github.com/ComputeCanada/matlab-parallel-server-samples/blob/master/README.md
# Follow instructions in https://github.com/ComputeCanada/matlab-parallel-server-samples/blob/master/README.md.


<!--T:48-->
<!--T:48-->
Note: when the <tt>ccSBATCH.m</tt> is in your current working directory, you may try the ''Cluster Profile Manager'' validation tool, but only the first two tests will work. Other tests are not yet supported.
Note: When the <tt>ccSBATCH.m</tt> is in your current working directory, you may try the ''Cluster Profile Manager'' validation tool, but only the first two tests will work. Other tests are not yet supported.


</translate>
</translate>
rsnt_translations
57,772

edits

Navigation menu