A Template Metaprogramming Approach to Support Parallel Programs for Multicores
Department of Computer Science, Shanghai Jiao Tong University, No. 800, Dongchuan Road, Shanghai, P.R.China
Shanghai Jiao Tong University, 2012
@article{liu2012template,
title={A Template Metaprogramming approach to Support Parallel Programs for Multicores},
author={Liu, X. and Guo, M. and Zhang, D. and Zhou, J. and Shen, Y.},
year={2012}
}
In advent of multicore era, plain C/C++ programming language can not fully reflect computer architectures any more. Source-to-source transformation helps tailor programs close to contemporary hardwares. We propose a template-based approach to perform transformation for programs with rich static information. The template metaprogramming techniques we present can conduct parallelization and memory hierarchical optimization for specific multicores. They enable programmers to utilize new architectural features and parallel patterns by extending template library. In this paper, we implement a prototype template library – libvina to demonstrate the idea. Finally, We evaluate our template library on commodity x86 and GPU platforms by a variety of typical applications in multimedia and scientific fields. In experiments, we show that our approach is flexible to support multiple parallel models and capable of transforming sequential code to parallel equivalence according to specific multicore architectures. Moreover, the cost of programmability using our approach to adapt more than one multicore platform is manageable.
January 17, 2012 by hgpu