MATLAB workshop 2011: Difference between revisions

From Cheaha
Jump to navigation Jump to search
(added upto validation)
Line 7: Line 7:
== Using MATLAB ==
== Using MATLAB ==
Using Mathworks software available under the UAB campus license on your computer involves download and install steps common to all software packages and an authorization step that grants you the rights to use the software under the campus agreement.  
Using Mathworks software available under the UAB campus license on your computer involves download and install steps common to all software packages and an authorization step that grants you the rights to use the software under the campus agreement.  
===Installation===


====Installation Overview====
====Installation Overview====
Line 23: Line 25:
# '''[[Simplified MATLAB Install]]''' - This is the recommended install when MATLAB will be used on computers that remain connected to the campus network.  This installation requires MatLab software to be installed on your computer and provides a simple 2-line file to activate the software.  This option is highly recommend.
# '''[[Simplified MATLAB Install]]''' - This is the recommended install when MATLAB will be used on computers that remain connected to the campus network.  This installation requires MatLab software to be installed on your computer and provides a simple 2-line file to activate the software.  This option is highly recommend.
# '''[[Matlab Designated Computer Install]]''' - This option is recommended for mobile computing systems which may not have network access when MATLAB is being used.  This install type authorizes an individual computer to run MATLAB, allowing MATLAB to run regardless of where the computer is located.
# '''[[Matlab Designated Computer Install]]''' - This option is recommended for mobile computing systems which may not have network access when MATLAB is being used.  This install type authorizes an individual computer to run MATLAB, allowing MATLAB to run regardless of where the computer is located.
===Configure MATLAB ===
====Configuration Overview ====
Configuring the Parallel Computing Toolbox involves three steps documented below:
# install MATLAB submit functions on your workstation
# configure the "cheaha" parallel computing target to which PCT tasks can be submitted
# run the validation tests to confirm a working installation.
This page documents the DCS configuration for MATLAB 2010b and later.  For DCS configuration instructions on previous versions of MATLAB, please see the page [[MatLab DCS R2010a and Earlier]]
Using MATLAB DCS requires you have a cluster account on [[Cheaha]].  Please request an account by sending an email to [[mailto:support@vo.uabgrid.uab.edu]] and include your campus affiliation and a brief statement of your research interests for using the cluster. 
==== MATLAB Submit Functions ====
The MATLAB submit functions create a cluster job context for your code and are responsible for transferring your code and the data it analyzes to the cluster for processing.
These submit functions must be installed on your computer and must be accessible to MATLAB via the MATLAB PATH environment.  The easiest way to accomplish this is to copy the submit functions to the default directory created for by MATLAB.  These directories on the respective operating systems are listed below.
# Download the MATLAB submit functions
#* [http://projects.uabgrid.uab.edu/matlab/browser/trunk/distributables/matlab-nonshared.zip?format=raw Submit Functions for MATLAB R2010b and later] -(updated 02/21/2011)
# Unzip the files to a directory included in your MATLAB PATH setting. Recommended locations are:
#* Windows:  <pre>My Documents\MATLAB</pre>
#* Linux:    <pre>$HOME/Documents/MATLAB</pre>
#* Mac:      <pre>$HOME/Documents/MATLAB</pre>
Once the submit function files have been downloaded and unzipped in the above paths, restart MATLAB to ensure they are properly loaded in your environment.
==== Parallel Computing Toolbox Configuration ====
The Parallel Computing Toolbox (PCT) enables language extensions in MATLAB that support dividing your application into tasks that can be executed in parallel.  By default, all of these tasks will run on your local workstation using the pre-defined "local" PCT configuration.
To run these tasks on the Cheaha compute cluster, a new configuration for the PCT must be defined.  In this section we will create the "cheaha" configuration and run a quick validation test to confirm its operation.
'''Prior to continuing''', make sure you:
* can establish an SSH connection to Cheaha
* have followed the steps in the previous section
===== Create the "cheaha" PCT Configuration =====
# Download and save the [http://projects.uabgrid.uab.edu/matlab/browser/trunk/parallel-configs/cheaha.mat?format=raw Cheaha cluster configuration file] in a file named "cheaha.mat".
# Start MATLAB on your workstation
# Click the "Parallel" menu
# Click "Manage Configurations"
# In the "Configurations Manager" window, click "File -> Import"
# Browse to the location where you saved the '''cheaha.mat''' file, select it, and click "Open"
The Configuration Manager should now list a new entry named "cheaha" as shown in the following image:
[[Image:2011_config_mngr.png|none|x400px]]
===== Personalize the "cheaha" PCT Configuration =====
#Double click on cheaha in the Configuration Manager window to open the configuration editor. (Note: stretch the "Generic Scheduler Configuration Properties" window to the right so that you can view all of the text in the fields making it easier to read and edit correctly.)
# Edit the following fields to use your personal data directories
#* '''ClusterMatlabRoot''': Make sure that the Root directory of MATLAB installation for workers matches the exact version of MATLAB you are using on your workstation. In this example '''/share/apps/mathworks/R2011a''' matches a MATLAB R2011a workstation install.  Change the "R2011a" to match your workstation MATLAB install.
#* '''DataLocation'''    : Change the directory path where job data is stored to an existing directory on your workstation. For example, on Windows  the directory '''C:\Users\<USERNAME>\Documents\MATLAB''' is created by default by MATLAB. Please confirm this directory is valid.
#* '''ParallelSubmitFcn''': Change the text "YOURUSERID" to your login id on Cheaha
#* '''SubmitFcn'''        : Change the text "YOURUSERID" to your login id on Cheaha
# Click 'OK'to save the configuration
The initial configuration will look similar to this screen shot.  You will need to edit the fields as describe in the preceding steps before you can use the configuration.  '''NOTE: be sure to replace the template user name settings "YOURUSERNAME" with the appropriate settings for your desktop and cluster account.'''
[[Image:Cheaha_parallel_config.png|none|x650px]]
===== Validate the "cheaha" PCT Configuration =====
# Select Cheaha on the configuration manager page and click 'Start Validation'
# Wait for the validation to complete. This might take a few minutes and you ask for User credentials on Cheaha. All tests other than 'Matlabpool' validate on the Cheaha and the output is as shown.
[[Image:Validation.png|none|x400px]]
Validation must pass the first three stages to use MATLAB on [[Cheaha]].

Revision as of 15:31, 16 September 2011

MATLAB (matrix laboratory) is a numerical computing environment and fourth-generation programming language. Developed by Mathworks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, and Fortran. An additional package, Simulink, adds graphical multi-domain simulation and Model-Based Design for dynamic and embedded systems.


In January 2011, UAB acquired a site license for MATLAB that allows faculty, staff, post-docs, and graduate students to use MATLAB, Simulink, and 42 toolboxes (including the parallel toolbox) for research activities on campus and personal systems. Additionally, MATLAB is available to students on campus computer systems.


Using MATLAB

Using Mathworks software available under the UAB campus license on your computer involves download and install steps common to all software packages and an authorization step that grants you the rights to use the software under the campus agreement.

Installation

Installation Overview

NOTE:These steps are common to all install scenarios and are detailed in Downloading and Installing MATLAB.

  1. Create an account at the Mathworks site using your campus @uab.edu email address.
  2. Request an activation key.
  3. Associate your Mathworks account with the campus-wide MATLAB license using your activation key.
  4. Download the software from the mathworks download site and install MATLAB. (Contact a MATLAB-TAH Asset Manager to get download rights)
  5. Activate the software using the activation scenario that best suits your particular needs.

Installation for Various Activation Scenarios

NOTE: Most on-campus users are encouraged to use the Simplified MATLAB Install option for activation unless there are special circumstances that require the alternative activation scenarios.

  1. Simplified MATLAB Install - This is the recommended install when MATLAB will be used on computers that remain connected to the campus network. This installation requires MatLab software to be installed on your computer and provides a simple 2-line file to activate the software. This option is highly recommend.
  2. Matlab Designated Computer Install - This option is recommended for mobile computing systems which may not have network access when MATLAB is being used. This install type authorizes an individual computer to run MATLAB, allowing MATLAB to run regardless of where the computer is located.


Configure MATLAB

Configuration Overview

Configuring the Parallel Computing Toolbox involves three steps documented below:

  1. install MATLAB submit functions on your workstation
  2. configure the "cheaha" parallel computing target to which PCT tasks can be submitted
  3. run the validation tests to confirm a working installation.

This page documents the DCS configuration for MATLAB 2010b and later. For DCS configuration instructions on previous versions of MATLAB, please see the page MatLab DCS R2010a and Earlier

Using MATLAB DCS requires you have a cluster account on Cheaha. Please request an account by sending an email to [[1]] and include your campus affiliation and a brief statement of your research interests for using the cluster.

MATLAB Submit Functions

The MATLAB submit functions create a cluster job context for your code and are responsible for transferring your code and the data it analyzes to the cluster for processing.

These submit functions must be installed on your computer and must be accessible to MATLAB via the MATLAB PATH environment. The easiest way to accomplish this is to copy the submit functions to the default directory created for by MATLAB. These directories on the respective operating systems are listed below.

  1. Download the MATLAB submit functions
  2. Unzip the files to a directory included in your MATLAB PATH setting. Recommended locations are:
    • Windows:
      My Documents\MATLAB
    • Linux:
      $HOME/Documents/MATLAB
    • Mac:
      $HOME/Documents/MATLAB

Once the submit function files have been downloaded and unzipped in the above paths, restart MATLAB to ensure they are properly loaded in your environment.


Parallel Computing Toolbox Configuration

The Parallel Computing Toolbox (PCT) enables language extensions in MATLAB that support dividing your application into tasks that can be executed in parallel. By default, all of these tasks will run on your local workstation using the pre-defined "local" PCT configuration.

To run these tasks on the Cheaha compute cluster, a new configuration for the PCT must be defined. In this section we will create the "cheaha" configuration and run a quick validation test to confirm its operation.

Prior to continuing, make sure you:

  • can establish an SSH connection to Cheaha
  • have followed the steps in the previous section
Create the "cheaha" PCT Configuration
  1. Download and save the Cheaha cluster configuration file in a file named "cheaha.mat".
  2. Start MATLAB on your workstation
  3. Click the "Parallel" menu
  4. Click "Manage Configurations"
  5. In the "Configurations Manager" window, click "File -> Import"
  6. Browse to the location where you saved the cheaha.mat file, select it, and click "Open"

The Configuration Manager should now list a new entry named "cheaha" as shown in the following image:

2011 config mngr.png
Personalize the "cheaha" PCT Configuration
  1. Double click on cheaha in the Configuration Manager window to open the configuration editor. (Note: stretch the "Generic Scheduler Configuration Properties" window to the right so that you can view all of the text in the fields making it easier to read and edit correctly.)
  2. Edit the following fields to use your personal data directories
    • ClusterMatlabRoot: Make sure that the Root directory of MATLAB installation for workers matches the exact version of MATLAB you are using on your workstation. In this example /share/apps/mathworks/R2011a matches a MATLAB R2011a workstation install. Change the "R2011a" to match your workstation MATLAB install.
    • DataLocation  : Change the directory path where job data is stored to an existing directory on your workstation. For example, on Windows the directory C:\Users\<USERNAME>\Documents\MATLAB is created by default by MATLAB. Please confirm this directory is valid.
    • ParallelSubmitFcn: Change the text "YOURUSERID" to your login id on Cheaha
    • SubmitFcn  : Change the text "YOURUSERID" to your login id on Cheaha
  3. Click 'OK'to save the configuration

The initial configuration will look similar to this screen shot. You will need to edit the fields as describe in the preceding steps before you can use the configuration. NOTE: be sure to replace the template user name settings "YOURUSERNAME" with the appropriate settings for your desktop and cluster account.

Cheaha parallel config.png
Validate the "cheaha" PCT Configuration
  1. Select Cheaha on the configuration manager page and click 'Start Validation'
  2. Wait for the validation to complete. This might take a few minutes and you ask for User credentials on Cheaha. All tests other than 'Matlabpool' validate on the Cheaha and the output is as shown.
Validation.png

Validation must pass the first three stages to use MATLAB on Cheaha.