MATLAB: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 48: Line 48:
USE_SERVER
USE_SERVER
}}
}}
Put this file in the <tt>$HOME/.licenses/</tt> directory where the IP address and port number correspond to the values for your campus license server. Next you will need to ensure that the license server on your campus is reachable by our compute nodes. This will require our technical team to get in touch with the technical people managing your license software. Please write to [[Technical support | technical support]] so that we can arrange this for you.
Put this file in the <code>$HOME/.licenses/</code> directory where the IP address and port number correspond to the values for your campus license server. Next you will need to ensure that the license server on your campus is reachable by our compute nodes. This will require our technical team to get in touch with the technical people managing your license software. Please write to [[Technical support | technical support]] so that we can arrange this for you.


<!--T:29-->
<!--T:29-->
Line 54: Line 54:
For product information, visit http://www.mathworks.com.
For product information, visit http://www.mathworks.com.


= Preparing your <tt>.matlab</tt> folder = <!--T:31-->
= Preparing your <code>.matlab</code> folder = <!--T:31-->
Because the /home directory is accessible in read-only mode on some clusters' compute nodes, users should create a <tt>.matlab</tt> symbolic link that makes sure that the MATLAB profile and job data will be written to the /scratch space instead.
Because the /home directory is accessible in read-only mode on some clusters' compute nodes, users should create a <code>.matlab</code> symbolic link that makes sure that the MATLAB profile and job data will be written to the /scratch space instead.


<!--T:32-->
<!--T:32-->
Line 135: Line 135:


<!--T:17-->
<!--T:17-->
Submit the job using <tt>sbatch</tt>:
Submit the job using <code>sbatch</code>:
{{Command|sbatch matlab_slurm.sl}}
{{Command|sbatch matlab_slurm.sl}}


Line 199: Line 199:


<!--T:10-->
<!--T:10-->
This will produce a binary named <tt>cosplot</tt>, as well as a wrapper script. To run the binary on our servers, you will only need the binary. The wrapper script named <tt>run_cosplot.sh</tt> will not work as is on our servers because MATLAB assumes that some libraries can be found in specific locations. Instead, we provide a different wrapper script called <tt>run_mcr_binary.sh</tt> which sets the correct paths.  
This will produce a binary named <code>cosplot</code>, as well as a wrapper script. To run the binary on our servers, you will only need the binary. The wrapper script named <code>run_cosplot.sh</code> will not work as is on our servers because MATLAB assumes that some libraries can be found in specific locations. Instead, we provide a different wrapper script called <code>run_mcr_binary.sh</code> which sets the correct paths.  


<!--T:18-->
<!--T:18-->
Line 225: Line 225:
On your computer:
On your computer:
# Have MATLAB R2022a or newer installed, <b>including the Parallel Computing Toolbox</b>.
# Have MATLAB R2022a or newer installed, <b>including the Parallel Computing Toolbox</b>.
# Go to the [https://www.mathworks.com/matlabcentral/fileexchange/52807-parallel-computing-toolbox-plugin-for-matlab-parallel-server-with-slurm MathWorks Slurm Plugin page], <b>download and run</b> the <tt>*.mlpkginstall</tt> file. (i.e., click on the blue <i>Download</i> button on the right side, just above the <i>Overview</i> tab.)
# Go to the [https://www.mathworks.com/matlabcentral/fileexchange/52807-parallel-computing-toolbox-plugin-for-matlab-parallel-server-with-slurm MathWorks Slurm Plugin page], <b>download and run</b> the <code>*.mlpkginstall</code> file. (i.e., click on the blue <i>Download</i> button on the right side, just above the <i>Overview</i> tab.)
# Enter your MathWorks credentials; if the configuration wizard does not start, run in MATLAB
# Enter your MathWorks credentials; if the configuration wizard does not start, run in MATLAB
#:<tt>parallel.cluster.generic.runProfileWizard()</tt>
#:<code>parallel.cluster.generic.runProfileWizard()</code>
# 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)
Line 245: Line 245:


== Edit the plugin once installed == <!--T:44-->
== Edit the plugin once installed == <!--T:44-->
In MATLAB, go to the <tt>nonshared</tt> folder (i.e., run the following in the MATLAB terminal):
In MATLAB, go to the <code>nonshared</code> folder (i.e., run the following in the MATLAB terminal):
  cd(fullfile(matlabshared.supportpkg.getSupportPackageRoot, 'parallel', 'slurm', 'nonshared'))
  cd(fullfile(matlabshared.supportpkg.getSupportPackageRoot, 'parallel', 'slurm', 'nonshared'))


<!--T:49-->
<!--T:49-->
Then:
Then:
# Open the '''independentSubmitFcn.m''' file; around line #117 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>
# Open the '''independentSubmitFcn.m''' file; around line #117 is the line <p> <code>additionalSubmitArgs = sprintf('--ntasks=1 --cpus-per-task=%d', cluster.NumThreads);</code> </p><p> Replace this line with</p><p> <code>additionalSubmitArgs = ccSBATCH().getSubmitArgs();</code></p>
# Open the '''communicatingSubmitFcn.m''' file; around line #126 is the line <p> <tt>additionalSubmitArgs = sprintf('--ntasks=%d --cpus-per-task=%d', environmentProperties.NumberOfTasks, cluster.NumThreads);</tt> </p><p> Replace this line with</p><p> <tt>additionalSubmitArgs = ccSBATCH().getSubmitArgs();</tt></p>
# Open the '''communicatingSubmitFcn.m''' file; around line #126 is the line <p> <code>additionalSubmitArgs = sprintf('--ntasks=%d --cpus-per-task=%d', environmentProperties.NumberOfTasks, cluster.NumThreads);</code> </p><p> Replace this line with</p><p> <code>additionalSubmitArgs = ccSBATCH().getSubmitArgs();</code></p>
# Open the '''communicatingJobWrapper.sh''' file; around line #20 (after the copyright statement), add the following command and adjust the module version to your local Matlab version:</p><p><tt>module load matlab/2022a</tt></p>
# Open the '''communicatingJobWrapper.sh''' file; around line #20 (after the copyright statement), add the following command and adjust the module version to your local Matlab version:</p><p><code>module load matlab/2022a</code></p>


<!--T:50-->
<!--T:50-->
Line 259: Line 259:


== Validation == <!--T:47-->
== Validation == <!--T:47-->
'''Do not''' use the built-in validation tool in the ''Cluster Profile Manager''. Instead, you should try the <tt>TestParfor</tt> example, along with a proper <tt>ccSBATCH.m</tt> script file:
'''Do not''' use the built-in validation tool in the ''Cluster Profile Manager''. Instead, you should try the <code>TestParfor</code> example, along with a proper <code>ccSBATCH.m</code> script file:
# 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 <code>TestParfor</code> 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 <code>ccSBATCH.m</code> 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.


= External resources = <!--T:51-->
= External resources = <!--T:51-->
rsnt_translations
57,772

edits

Navigation menu