Design Patterns for High-Performance Matrix Computations

This paper discusses fundamental issues of developing high-performance matrix computation software in an object-oriented language like C++ and presents key design patterns for solving these problems. These object-oriented design patterns are implemented i

  • PDF / 205,201 Bytes
  • 11 Pages / 439.324 x 666.21 pts Page_size
  • 83 Downloads / 247 Views

DOWNLOAD

REPORT


Abstract This paper discusses fundamental issues of developing high-performance matrix computation software in an object-oriented language like C++ and presents key design patterns for solving these problems. These object-oriented design patterns are implemented in FMOL++ (Fundamental Mathematical Object Library) – a C++ template library, which includes basic algebraic structures and operations as well as common model classes needed by control system analysis and design. Through over a decade of evolutions, these patterns have proved to provide bestpractice solutions to most common problems in the context of high-performance matrix computation. Benchmarks are made for performance comparisons between FMOL++ and alternative approaches.

1 Introduction For modeling, simulation, analysis and design of complex systems, highperformance and easy-to-use matrix computation software is always needed. Traditionally, one would make use of well-proved software packages written in FORTRAN, such as LAPACK [1]. This software package has proved to be very efficient and reliable, but its lengthy and unreadable coding style makes itself a high-potential source of errors. There are also translations to C programming language, but the use is very limited since they do not offer real advantages over FORTRAN original version except a wider portability. Today, the availability of commercial products like MATLAB makes matrix computation almost simple as just writing down mathematical expressions on the paper [2]. Although these software products are very powerful and useful for many purposes such as modeling, analysis, design, simulation and off-line optimization, there are many situations where native-language matrix libraries are more appropriate, e.g. real-time (and distributed) simulation, real-time control implementation and on-line optimization, see e.g. [3–5]. Besides the question of licensing price, it is often claimed that program code generated by universal tools are neither efficient enough nor easily embeddable into realtime applications.

510

H.M. Son

The combination of object-oriented programming methods and supports from a high-level language like C++ allows the development of very flexible and highly reusable software. Because of its maturity and many excellent features, the C++ programming language is the definitive choice for many users [6, 7]. LAPACK++ [8] and its successor, so called TNT [9], are two examples of C++ matrix packages that are widely used. However, objectoriented design is hard and object-oriented design of high-efficient, elegant, flexible and reusable matrix library is much harder. In fact, while there are many other matrix libraries are freely available from the Internet, very few of them are well designed in the author’s viewpoint. The most critical design challenge involves the trade-offs between diverse requirements (such as between simplicity and flexibility, elegance and efficiency, compactness and openness, and so on), which are often in conflict to each other. For example, while the operator-overloading featu