08.11.2014 Views

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

array languages instead of conventional languages such asFortran and C. One reason is<br />

the interactive nature of the language, which facilitates debugging and analysis. A second<br />

reason is that interactive array languages are usually contained within problem-solving environments<br />

which include easy-to-use facilities for displaying results both graphically and in<br />

tabular form [GHR94]. Third, in these languages it is not necessary to specify the dimension,<br />

rank, or intrinsic type of elements of arrays. While some researchers may consider that<br />

lack oftyping increases the probability of error, in practice programmers nd that this is<br />

a convenient feature. Finally, these languages also have an extensive set of functions and<br />

higher-level operators, such as array and matrix addition, multiplication, division, matrix<br />

transpose, and vector reductions, that facilitate the development of scientic programs.<br />

The downside is that interactive array languages are implementedwithinterpreters and,<br />

therefore, their execution is sometimes inecient. The interpreter spends its time reading<br />

and parsing the program, determining the intrinsic type of the operations, dynamically<br />

allocating storage for the resulting variables, and performing the operations.<br />

In fact, a<br />

large fraction of the interpreter's execution time is wasted doing work that could be done<br />

statically by a compiler. For example, the compiler could determine the intrinsic type of<br />

elements and the dimensions and shape of many operands in the program by doing global<br />

ow analysis. In this way, the execution could be made more ecient by eliminating the<br />

need for some or all of the run-time bookkeeping operations. A study of the eectiveness<br />

of this type of approach on APL programs is presented in [Bud88]. When the bulk of the<br />

computations is done by the high-level array functions, the ineciency of the interpreter<br />

is less of a problem.<br />

This is because these high-level functions are not interpreted and<br />

the bookkeeping operations need to be performed only when the function is invoked and/or<br />

returns. However, for some applications and algorithms, such functions are not sucientand<br />

the program needs to execute a signicant number of loops and scalar operations. In some<br />

experiments wehave conducted [DPar], it was observed that interpreting programs executing<br />

mainly loops and scalar operations could be up to three orders of magnitude slower than<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!