{"id":233,"date":"2013-04-23T10:53:29","date_gmt":"2013-04-23T10:53:29","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/?page_id=233"},"modified":"2019-02-04T12:51:17","modified_gmt":"2019-02-04T12:51:17","slug":"matlab","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/software\/applications\/matlab\/","title":{"rendered":"MATLAB"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>MATLAB [MATrix LABoratory] is an integrated technical computing environment from The Mathworks that combines numeric computation, 2- and 3-d graphics &amp; visualisation, and a high-level programming language.<\/p>\n<p>Version 2017a is the most up to date version installed on the CSF.<\/p>\n<h2>Restrictions on use<\/h2>\n<p>Only compiled MATLAB applications should be used on the CSF; interactive use of MATLAB is strongly discouraged. The only MATLAB components you should run on the login node are the <code>mcc<\/code>\u00a0and mex compilers.<\/p>\n<p>Please note that a MATLAB job cannot run on more than one CSF node. This is because the University does not have licenses for the distributed computing server product. The maximum job size is therefore 12 cores. Please get in touch if you would like help assessing the requirements of your job.<\/p>\n<h2>Set up procedure<\/h2>\n<p>To set up the MATLAB environment, you need to issue the following command<\/p>\n<pre>module load apps\/binapps\/matlab\/R2017a<\/pre>\n<h4>Change in behaviour<\/h4>\n<p>gcc version 4.9.x is requried for MATLAB 2017a:\u00a0loading the MATLAB module (e.g. by using the command above) will automatically load this for you.<\/p>\n<p>gcc version 4.7.x is required for MATLAB 2016a, 2015a and 2014a; loading the MATLAB module (e.g. by using the command above) will automatically load this for you.<\/p>\n<p>Older versions of MATLAB are available using one of:<\/p>\n<pre>module load apps\/binapps\/matlab\/R2016a\r\nmodule load apps\/binapps\/matlab\/R2015a\r\nmodule load apps\/binapps\/matlab\/R2014a\r\nmodule load apps\/binapps\/matlab\/R2013a\r\nmodule load apps\/binapps\/matlab\/R2012a\r\nmodule load apps\/binapps\/matlab\/R2011a\r\nmodule load apps\/binapps\/matlab\/R2010a\r\n\r\n<\/pre>\n<h2>Running the application<\/h2>\n<p>You <strong>must<\/strong> compile your MATLAB code before running it on the CSF in the batch system.<\/p>\n<ul>\n<li><a href=\"\/csf-apps\/software\/applications\/matlab\/fundamentalsonthecsf\">Fundamentals<\/a> &#8211; How to compile and submit a very simple MATLAB example on the CSF.<\/li>\n<li><a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/software\/applications\/matlab\/matlab-compilation-advice\/\">MATLAB Compilation advice<\/a> &#8211; further advice for MATLAB on the CSF.<\/li>\n<\/ul>\n<p>NOTE: If you are running an application that uses random numbers, it is suggested that you read and understand the article <a href=\"http:\/\/www.walkingrandomly.com\/?p=2755\">Parallel Random Numbers in MATLAB<\/a><\/p>\n<h2>Official Toolboxes<\/h2>\n<p>The following toolboxes are available in MATLAB R2016a and R2015a<\/p>\n<ul>\n<li>Bioinformatics Toolbox<\/li>\n<li>Control System Toolbox<\/li>\n<li>Embedded Coder<\/li>\n<li>Financial Toolbox<\/li>\n<li>Fuzzy Logic Toolbox<\/li>\n<li>Global Optimization Toolbox<\/li>\n<li>Image Processing Toolbox<\/li>\n<li>MATLAB<\/li>\n<li>MATLAB Coder<\/li>\n<li>MATLAB Compiler<\/li>\n<li>Neural Network Toolbox<\/li>\n<li>OPC Toolbox<\/li>\n<li>Optimization Toolbox<\/li>\n<li>Parallel Computing Toolbox<\/li>\n<li>Partial Differential Equation Toolbox<\/li>\n<li>Robust Control Toolbox<\/li>\n<li>Signal Processing Toolbox<\/li>\n<li>Simulink<\/li>\n<li>Simulink 3D Animation<\/li>\n<li>Simulink Coder<\/li>\n<li>Simulink Control Design<\/li>\n<li>Statistics and Machine Learning Toolbox<\/li>\n<li>Symbolic Math Toolbox<\/li>\n<li>System Identification Toolbox<\/li>\n<li>Wavelet Toolbox<\/li>\n<\/ul>\n<p>The following toolboxes are available in MATLAB 2014a<\/p>\n<ul>\n<li>MATLAB<\/li>\n<li>Simulink<\/li>\n<li>Bioinformatics Toolbox<\/li>\n<li>Control System Toolbox<\/li>\n<li>Financial Toolbox<\/li>\n<li>Fuzzy Logic Toolbox<\/li>\n<li>Global Optimisation Toolbox<\/li>\n<li>Image Processing Toolbox<\/li>\n<li>MATLAB Coder<\/li>\n<li>MATLAB Compiler<\/li>\n<li>Neural Networks<\/li>\n<li>Optimization Toolbox<\/li>\n<li>Parallel Computing Toolbox<\/li>\n<li>PDE Toolbox<\/li>\n<li>Robust Control Toolbox<\/li>\n<li>Signal Processing Toolbox<\/li>\n<li>Simulink 3D Animation<\/li>\n<li>Simulink Coder<\/li>\n<li>Simulink Control Design<\/li>\n<li>Statistics Toolbox<\/li>\n<li>Symbolic Math<\/li>\n<li>System ID<\/li>\n<li>Wavelets<\/li>\n<\/ul>\n<p>The following toolboxes are available in MATLAB 2013a and below<\/p>\n<ul>\n<li>MATLAB<\/li>\n<li>Simulink<\/li>\n<li>Bioinformatics Toolbox<\/li>\n<li>Control System Toolbox<\/li>\n<li>Fuzzy Logic Toolbox<\/li>\n<li>Global Optimization Toolbox<\/li>\n<li>Image Processing Toolbox<\/li>\n<li>MATLAB Coder<\/li>\n<li>MATLAB Compiler<\/li>\n<li>Neural Network Toolbox<\/li>\n<li>Optimization Toolbox<\/li>\n<li>Parallel Computing Toolbox<\/li>\n<li>Robust Control Toolbox<\/li>\n<li>Signal Processing Toolbox<\/li>\n<li>Statistics Toolbox<\/li>\n<li>Symbolic Math Toolbox<\/li>\n<li>System Identidication Toolbox<\/li>\n<li>Wavelet Toolbox<\/li>\n<\/ul>\n<p>Please note that some of these toolboxes have extremely limited numbers of licenses. For example, there are only two licenses for the Bioinformatics toolbox site-wide.<\/p>\n<p>If you can&#8217;t access one of the above toolboxes, or if you need to use a toolbox that isn&#8217;t included here, please read the advice given at the following URL. It gives advice on how to use alternatives to toolboxes along with contact details of IS Staff who can facilitate the purchase of extra toolboxes.<\/p>\n<ul>\n<li><a href=\"http:\/\/www.applications.itservices.manchester.ac.uk\/show_content.php?id=100\">Licensing of MATLAB Toolboxes<\/a><\/li>\n<\/ul>\n<h2>Additional Toolboxes<\/h2>\n<p>The following are available:<\/p>\n<h3><a href=\"http:\/\/cvxr.com\/cvx\/\">CVX<\/a><\/h3>\n<p><code>module load apps\/binapps\/matlab\/thirdparty\/cvx\/2.1<\/code><\/p>\n<h3><a href=\"https:\/\/yalmip.github.io\/\">YALMIP<\/a><\/h3>\n<p><code>module load apps\/binapps\/matlab\/thirdparty\/yalmip\/R20160930<\/code><\/p>\n<h3><a href=\"https:\/\/github.com\/horchler\/SDETools\">SDETools<\/a><\/h3>\n<p><code>module load apps\/binapps\/matlab\/thirdparty\/sdetools\/1.2<\/code><\/p>\n<h3><a href=\"http:\/\/www.fil.ion.ucl.ac.uk\/spm\/software\/spm12\/\">SPM<\/a><\/h3>\n<p>Version 12 latest:<\/p>\n<pre>\r\nmodule load apps\/binapps\/matlab\/thirdparty\/spm\/12-latest\r\n  #\r\n  # !!! Note this will always point to the most recent version we have added\r\n  # If you need a specific version or do not want anything to unexpectedly change\r\n  # please ensure you use a specific modulefile from those below\r\n<\/pre>\n<p>Version 12 revision 6906: <code>module load apps\/binapps\/matlab\/thirdparty\/spm\/12-r6906<\/code><\/p>\n<p>Version 12 revision 5953: <code>module load apps\/binapps\/matlab\/thirdparty\/spm\/12b<\/code><\/p>\n<h4>Compilation (basic usage)<\/h4>\n<p>After loading the SPM module file, the SPM toolbox should be compiled as follows:<\/p>\n<pre>\r\n# Create a directory in your scratch area and use that directory name in all commands.\r\n# This is easy to do if we set an environment variable:\r\nexport SPM12_STANDALONE=~\/scratch\/SPM12-standalone\r\nmkdir -p $SPM12_STANDALONE\r\n\r\n# Now compile the spm12 wrapper script in to our directory:\r\nmcc -m -C -v -o spm12 -d $SPM12_STANDALONE -N -p $MATLAB_HOME\/toolbox\/signal\/ -R singleCompThread \\\r\n  -a $SPM12_ROOT $SPM12_ROOT\/spm_standalone.m\r\n<\/pre>\n<h3>Compilation (including your own toolbox code)<\/h3>\n<p>If you need to use code from your own toolbox, you will need to modify the compilation command above to include your toolbox folder using the <code>-a<\/code> flag as follows:<\/p>\n<pre>\r\n# Create a directory in your scratch area and use that directory name in all commands.\r\n# This is easy to do if we set an environment variable:\r\nexport SPM12_STANDALONE=~\/scratch\/SPM12-standalone\r\nmkdir -p $SPM12_STANDALONE\r\n\r\nmcc -m -C -v -o spm12 -d $SPM12_STANDALONE -N -p $MATLAB_HOME\/toolbox\/signal -R singleCompThread \\\r\n  -a $SPM12_ROOT <strong>-a path\/to\/yourtoolbox<\/strong> $SPM12_ROOT\/spm_standalone.m\r\n<\/pre>\n<h3>Submitting a job<\/h3>\n<p>After compilation, change directory to your SPM12 standalone directory so that our jobscript can find the files we compiled above:<\/p>\n<pre>cd $SPM12_STANDALONE<\/pre>\n<p>Then use this line in your job script (instead of the usual matlab commands):<\/p>\n<pre>.\/run_spm12.sh $MATLAB_HOME script <em>yourscript.m<\/em>             # Replace <em>yourscript.m<\/em> with the name of your script\r\n<\/pre>\n<p>The compiled spm12 code will run the matlab code you have written in <em>yourscript.m<\/em> but this is still essentially a compiled matlab job so will be kind to the license servers.<\/p>\n<h3><a href=\"http:\/\/marsbar.sourceforge.net\/\">Marsbar<\/a> and <a href=\"http:\/\/www.fieldtriptoolbox.org\/\">fieldtrip<\/a><\/h3>\n<p><code>\/opt\/gridware\/apps\/binapps\/matlab\/third_party_toolboxes\/marsbar<\/code><br \/>\n<code>\/opt\/gridware\/apps\/binapps\/matlab\/third_party_toolboxes\/fieldtrip<\/code><\/p>\n<p>You should set your <code>MATLABPATH<\/code> appropriately to use them.<\/p>\n<p>&nbsp;<\/p>\n<h3><a href=\"https:\/\/www.nag.co.uk\/nag-toolbox-matlab\">NAG<\/a><\/h3>\n<p><code>module load apps\/binapps\/matlab\/thirdparty\/nag\/25<\/code><\/p>\n<h2>Further information<\/h2>\n<ul>\n<li><a href=\"http:\/\/wiki.rac.manchester.ac.uk\/community\/MATLAB\">Community Wiki page on MATLAB<\/a><\/li>\n<li>It is often possible to speed-up MATLAB code significantly using techniques such as vectorisation, mex files, parallelisation and more. If you would like advice on how to optimise your MATLAB application then contact the <a href=\"https:\/\/supportcentre.manchester.ac.uk\/ServiceDesk.WebAccess\/ss\/object\/open.rails?class_name=AssetManagement.Service&amp;key=418d500f-ac86-4226-9a1a-1eab14f94a4d\">Research IT applications team<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Overview MATLAB [MATrix LABoratory] is an integrated technical computing environment from The Mathworks that combines numeric computation, 2- and 3-d graphics &amp; visualisation, and a high-level programming language. Version 2017a is the most up to date version installed on the CSF. Restrictions on use Only compiled MATLAB applications should be used on the CSF; interactive use of MATLAB is strongly discouraged. The only MATLAB components you should run on the login node are the mcc\u00a0and.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/software\/applications\/matlab\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":31,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-233","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/comments?post=233"}],"version-history":[{"count":21,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/233\/revisions"}],"predecessor-version":[{"id":3731,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/233\/revisions\/3731"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/31"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/media?parent=233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}