A code transformation framework for linear algebra operations targeting multiple platforms

Linear algebra is used in many fields of mathematics, natural sciences, computer science, and social science. The researchers in those fields, who are not experienced programmers, may write naive linear algebra codes for their applications. Despite the availability of multiple hardware platforms for...

Full description

Saved in:
Bibliographic Details
Main Author: Tan, Wen Jun
Other Authors: Stephen John Turner
Format: Theses and Dissertations
Language:English
Published: 2014
Subjects:
Online Access:https://hdl.handle.net/10356/61835
Tags: Add Tag
No Tags, Be the first to tag this record!
Institution: Nanyang Technological University
Language: English
Description
Summary:Linear algebra is used in many fields of mathematics, natural sciences, computer science, and social science. The researchers in those fields, who are not experienced programmers, may write naive linear algebra codes for their applications. Despite the availability of multiple hardware platforms for computation, such as vector processing units, multi-core processors and general-purpose graphics processing units, it is particularly difficult for them to optimize their applications for these platforms. It is necessary to make use of hardware-specific architectural features to fully exploit the capabilities of the underlying hardware. This thesis presents a code transformation framework for assisting users writing naive linear algebra codes to optimize their applications. The code transformation framework recognizes and extracts the linear algebra operations from naive codes. The linear algebra intermediate representation can be expressed in terms of a domain specific language. The user can also write linear algebra kernels using this language directly. Using the intermediate representation, the framework transforms the linear algebra operations to equivalent library calls. There are two possible classes of code generated from the framework: (i) linear algebra template libraries and (ii) BLAS function calls. The linear algebra template libraries present the linear algebra operations in an algebraic form that is easily understandable by the user, and at the same time provides good performance when codes are compiled. It is possible to target multiple platforms through different linear algebra template libraries, such as Eigen and Armadillo. Although C++ template libraries are more intuitive to the user, these template libraries introduce additional overhead due to the library design. Therefore the code transformation framework is extended to generate calls to BLAS for different platforms, such as Intel MKL or Nvidia CUBLAS. We demonstrate that the code transformation framework can result in better performance in the generated codes compared to those which are generated by existing compilers. This is substantiated by experimental results on different hardware platforms, including vector processing units, multi-core processors and graphics processing units.