Matlab FAQ
This is a short FAQ on using the high-level language code "Matlab" on the Sun Fire cluster. This software is only licensed for academic researchers who already hold Abaqus license. Under this condition, HPCVL provides additional processes to enable parallel runs of Matlab programs. The software is only made available to persons who belong to a specific Unix group. See details below.


Questions:

  1. What is "Matlab"?

  2. Where is "Matlab" located and how do I access it??

  3. How do I use "Matlab" interactively?

  4. How do I set up and submit parallel "Abaqus" jobs to the HPCVL clusters?

  5. Where can I get further help?

Answers:

  1. What is "Matlab"?

    From the Matlab web page: "MATLABŪ is a high-level technical computing language and interactive environment for algorithm development, data visualization, data analysis, and numeric computation. [...] You can use MATLAB in a wide range of applications, including signal and image processing, communications, control design, test and measurement, financial modeling and analysis, and computational biology. Add-on toolboxes (collections of special-purpose MATLAB functions, available separately) extend the MATLAB environment to solve particular classes of problems in these application areas."

    Here is a list of features, also from the webpage:

    • High-level language for technical computing
    • Development environment for managing code, files, and data
    • Interactive tools for iterative exploration, design, and problem solving
    • Mathematical functions for linear algebra, statistics, Fourier analysis, filtering, optimization, and numerical integration
    • 2-D and 3-D graphics functions for visualizing data
    • Tools for building custom graphical user interfaces
    • Functions for integrating MATLAB based algorithms with external applications and languages, such as C, C++, Fortran, Java, COM, and Microsoft Excel
    HPCVL provides and extension to our user's pre-existing Matlab licenses that allows them to run Matlab programs on our servers in parallel. The full Matlab program and most Toolboxes are installed on our systems, but the license for their usage is supplied by the user. HPCVL contributes the parallel processes (up to 16 per job for a total of 64) to run on our production clusters.

    Back to Top...

  2. Where is "Matlab " located and how do I access it?

    The present version of Matlab is R2008b. The programs in the Matlab package are located in the directory /opt/matlab

    Note that most Matlab Toolboxes are installed on the HPCVL clusters. However, HPCVL only holds a "3rd party access MATLAB Distributed Computing Server license". This enables HPCVL users who have a pre-existing Matlab license (Matlab + "Distributed Computing Toolbox (DCT)") to submit and run parallel Matlab jobs to our cluster nodes.

    It is furthermore required that you sign a statement. We will confirm this statement, and you will then be made a member of a Unix group "matlab", which enables you to access the software. Contact us if you are in doubt of whether you will be able to run Matlab on our system.

    Our Matlab license is "process limited". At present, there are 64 processes available. A single Matlab run can use up to 16 processes, and up to 2 Matlab jobs can run at a time for a given HPCVL user.

    Back to Top...

  3. How do I run "Matlab" interactively?

    The core of Matlab is a high-level programming language and an interactive programming/computing environment. Since you have to be a licensed user of Matlab to run Matlab programs on HPCVL machines, it is possible for you to either start a Matlab session on your own work station, or move the license to your HPCVL account and use our installation of the software. In either case, you are responsible for mainaining the license.

    If you are running a Matlab session on HPCVL, the interactive part is usually started on a login node, for instance sflogin0. We assume that you are included in the "matlab" Unix group, and therefore have proper access to /opt/matlab where the software resides. To set the proper environment variables and include the directories with the binaries in your PATH, you should type:

    use matlab
    To avoid having to do this before every Matlab session, you may also include this command in your setup file, e.g. .bash_profile for a bash shell, or .login for a csh. The above command is equivalent to adding /opt/matlab/R2008b/64bit/bin to your PATH. Finally you need to point the environment variable LM_LICENSE_FILE to the proper license file:
    export LM_LICENSE_FILE=lic_file (bash)
    setenv LM_LICENSE_FILE lic_file (csh)
    where lic_file stands for the full path and file name of your license file. You need to make sure that the latter cannot be accessed by anyone but you. This command may of course also be placed into a setup file to avoid retyping.

    Once Matlab usage is set up properly, you only need to type

    matlab
    to start the GUI of the Matlab programming environment. Issuing the command with the -nodisplay will give you a command-line version that does not use the GUI.
    Back to Top...

  4. How do I setup and run a parallel Matlab batch job on the HPCVL clusters?

    In most cases, you will run Matlab in parallel "Batch" mode on our clusters. Since you have to have access to Matlab outside of the HPCVL license, most interactive work could be done elsewhere, whereas the computationally intensive runs can be executed on HPCVL clusters.

    Production jobs on HPCVL clusters are submitted via the GridEngine, which is a load-balancing software. To obtain details, read our Gridengine FAQ . For a Matlab batch job, this means that you have to prepare your Matlab setup to interface with GridEngine.

    To setup running parallel jobs, you need to create a "Parallel Configuration" in Matlab. This needs to be done only once. First, you call a Configuration Manager by selecting the Parallel tab and the Manage Configurations sub-tab in the Matlab GUI. In the Configuration Manager Window, select File -> New -> generic to add a new configuration. Youu will be given a Generic Scheduler Configuration Properties window, and need to fill in the following items:

    • Choose a Configuration name (for instance SGE), and enter it in the corresponding text box.
    • Into the (ClusterMatlabRoot) box, enter /opt/matlab/R2008b/64bit.
    • Into the (ClusterSize) box, enter 16.
    • Into the (ParallelSubmitFunction) box, enter {@sgeParallelSubmitFcn,'sfnode0.hpcvl.queensu.ca','/scatch'}.
    • Into the (SubmitFunction) box, enter {@sgeSubmitFcn,'sfnode0.hpcvl.queensu.ca','/scatch'}.
    • In the (ClusterOsType) tab, select unix.
    • In the (HasSharedFileSystem) tab, select True if you are setting up Matlab on an HPCVL node, and False if you are setting up on a remote system.

    After making these entries, you select from the main Matlab window Parallel -> Select Configuration -> SGE (assuming you called the new configuration SGE. You should also go back ionto the Configuration Manager by selecting Parallel -> Manage Configurations and select SGE as a default. The Configuration Manager also lets you validate your new configuration by highlighting it and press the Start Validation button.

    Once your parallel configuration is properly set up to enable job submission to the HPCVL production clusters, you can create a so-called Matlab Pool by typeing the following command in the main Matlab window or command line:

    matlabpool open SGE 8
    where we are assuming that you called the configuration SGE and want to run you Matlab program with 8 processors. Note that you should not select more than 16 processes because that was the ClusterSize limit defined in the configuration SGE.

    At this point Matlab will submit a reservation of 8 processors to the Grid Engine, and SGE will schedule it when the requested resources (i.e. enough processors and licenses) are available. Of course, you have not yet defined what you want to run with these 8 processors. Let us assume you have a parallel Matlab program, for instance the following simple mywave.m:

    parfor i=1:1024
      A(i) = sin(i*2*pi/1024);
    end
    which computes 1024 points in a sinewave and stores the result in a vector called "A". You can submit this program by typing
    mywave
    and it will use the Matlab pool of processes that you just started for execution. Once the program returns from its run (i.e. the prompt re-appears) you don't need the pool anymore and can close it with
    matlabpool close

    All of these command can be included in a single file, for instance the mywave.m file, and the quence reduces to simply typing

    mywave

    Back to Top...

  5. Where can I get further help?

    Matlab is a complex software package, and requires some practice to be used efficiently. In this FAQ we can not explain its use in any detail. Luckily, Matlab features a complete set of online-documentation that may be accessed from inside the GUI by selecting the Help tab. There are also a Getting Started Tutorial and various Demos.

    If you have problems with the GridEngine, read our FAQ on that subject, and maybe consult the manual for that software which is accessible as a PDF file. HPCVL also provide user support in the case of technical problems. Contact us here, we might be able to help, or pass you on to someone who can.

    Back to Top..
    .


 
 
   
© HPCVL 2009