Scaling Beyond the Desktop with MATLAB

Parallel MATLAB apps make programming simple and portable.

Parallel MATLAB apps make programming simple and portable.

By A. Chakravarti, P.S. Ivanov and J. Rorison

 
Scaling Beyond the Desktop with MATLAB
This is a comparison of computation time on one workstation core to time on the EGEE grid.

Parallel computing technologies offer engineers the means to accelerate solutions of their computational problems by using multiple hardware resources. The ability to solve very large problems by scaling computer programs to run on multicore workstations, clusters, grids, and clouds can help engineers gain significant research and competitive advantages.

  Engineers who need their computer programs to run faster or process larger data sets would prefer that every program automatically use parallelism. However, automatic parallelism is still a subject of basic computer science research. Thus, the responsibility of using parallelism to run programs across multiple cores or computers is shared by the designers of programming languages/environments and their users.

  This article explores the expectations that engineers have when using scalable parallel computing technologies as well as how the designers of MATLAB have attempted to meet those expectations.

Required Capabilities
Engineers are primarily concerned with solving complex problems within their technical domains. While some may be experienced programmers, most would prefer to be shielded from the finer points of parallel programming, such as multithreading, synchronization, and data management across clusters. For this reason, a parallel computing environment needs to make it as easy as possible for engineers to write, use, and maintain parallel programs.

  Engineers use a variety of operating systems and hardware. They do not want to change code when migrating applications from one operating system to another, or from a multicore desktop computer to a large cluster. Their colleagues and customers should also never have to modify code. Scalability and portability are key requirements for a parallel computing environment because most engineers would just want their parallel applications to seamlessly use whatever resources are available.

  A major roadblock for any engineer who wants to use remote cluster hardware is the need to have specific knowledge about the cluster. Most engineers would prefer that the cluster administrator write system-specific scripts, set environment variables, and manage job queues. The separation of user and administrator tasks is an important requirement.

 
Scaling Beyond the Desktop with MATLAB
Top view of a PC-VCSEL. The photonic crystal has holes with 2mm diameter and 4mm center-to-center spacing.

Scaling Beyond the Desktop
There are a number of parallel computing technologies available to an engineer. Some, such as Intel TBB and Cilk, enable programmers to write parallel programs that use multicore computers. However, the same programs cannot scale up to use remote resources like clusters. Programs often need to be rewritten to use other technologies such as MPI, which are complex and require specialized knowledge. This workflow violates the important requirement that the same parallel program scale from workstations to clusters without any recoding.

  Specialized technologies like MPI have the additional drawback of requiring the user of a parallel program to have some knowledge of the system on which it will be run. This reduces the portability of code and the number of people who can use it.

The MATLAB Approach
The designers of MATLAB attempt to fulfill the parallel computing requirements of ease-of-programming, scalability and portability, and separation of user and administrator roles by offering different levels of control to programmers. Some programs require no recoding, while others require the use of low-level programming methods. The most commonly used programming techniques involve adding annotations to code. For example, a FOR loop with independent iterations can be annotated as a PARFOR loop. At runtime, the computing environment will attempt to run the loop iterations in parallel across multiple MATLAB workers (execution engines that run in the background on a workstation or cluster).

  The MATLAB programming language is separated from the execution environment. This means that the same parallel program can run on multicore workstations as well as on clusters, grids, and clouds. An engineer who writes a parallel MATLAB program does not need to know anything about where the program will eventually run, lending portability across different hardware and operating systems. For example, an engineer who develops a program on a Windows workstation can run the same program on a Linux cluster, or share it with a colleague who uses a Mac laptop.

  Scaling up a parallel MATLAB program from workstation to cluster does not require the user to have any knowledge of the cluster because MATLAB allows for the roles of user and cluster administrator to be independent of each other. The administrator stores information about the cluster in a configuration file, e.g., how to submit jobs and transfer data, and sends it to all cluster users. In fact, a user could receive several configurations, one for each remote resource. The user imports the configurations into the MATLAB user interface and selects one of them as the resource on which to run the parallel MATLAB program.

  Here’s the typical workflow of an engineer who wishes to solve a large technical problem in MATLAB: The user writes a serial program and then parallelizes it by using constructs such as PARFOR. The user tests and debugs the program with small inputs on the workstation. Finally, the user increases the size of inputs to the program, imports a configuration for a remote cluster, and reruns the program on that cluster.

MATLAB in the Real World
The Optics group at University of Bristol performs research on Semiconductor Vertical-Cavity Surface-Emitting Lasers (VCSELs), which are widely used in fiber-optical telecommunication networks. The group develops new generations of VCSELs with photonic crystals (PC-VCSELs). In order to perform numerical simulations using models of PC-VCSELs, MATLAB solvers were used for 2D partial differential scalar Helmholtz equations and ordinary differential laser rate equations. The approximated solution time of equations of models varied from 10-700 minutes for some models and 4-60 hours for others. Since these models used many input parameters, the computation of PC-VCSEL characteristics and their optimization required hundreds of solutions of equations. The problem was clearly too large for a desktop system; performing the computations on a lab workstation would have taken several days.

  Researchers parallelized the MATLAB program by structuring it as a job that computed parameters of optical modes of PC-VCSELs N times. Therefore, there were N tasks, each of which computed parameters of optical modes. Researchers first tested and debugged the program by using multiple MATLAB workers on a workstation. Once the correctness of the parallel MATLAB program had been established, it was decided to run it on a grid system provided by EGEE (Enabling Grids for E-sciencE), the consortium that provides more than 70,000 processor cores to users worldwide. By using a portion of this infrastructure, the time for computation of 300 tasks was reduced from more than five days to just six hours—an improvement of 21 times.

  Parallel programming environments that allow engineers to solve technical problems on and beyond desktop computers are important enablers of technical activity. MATLAB provides engineers with the ability to parallelize programs and to then scale beyond the desktop without modifying the program or writing any additional code.

More Info:
Cilk Arts, Inc.
Lexington, MA

Intel
Santa Clara, CA

The MathWorks
Natick, MA

University of Bristol
Bristol, UK

 


Arjav Chakravarti is the parallel computing marketing manager for The MathWorks, Inc., Pavel S. Ivanov, Ph.D. is a Great Western research fellow in the department of electrical and electronic engineering at the University of Bristol and Judy Rorison, Ph.D. is a reader in the department of electrical and electronic engineering at the University of Bristol. Send comments about this article to [email protected].

Share This Article

Subscribe to our FREE magazine, FREE email newsletters or both!

Join over 90,000 engineering professionals who get fresh engineering news as soon as it is published.


About the Author

DE Editors's avatar
DE Editors

DE’s editors contribute news and new product announcements to Digital Engineering.
Press releases may be sent to them via [email protected].

Follow DE
#6789