XPU: A C++ Metaprogramming Approach to Ease Parallelism Expression: Parallelization Methodology, Internal Design and Practical Application
Résumé
The continuous proliferation of multicore architectures has placed developers under great pressure to parallelize theirapplications in order to take advantage of such platforms. Unfortunately, traditional low-level programming modelsexacerbate the difficulties of building large and complex parallel applications. Consequently, programmers are facing acomplex productivity performance trade-off where they should extract enough parallelism to justify the use of a dedicatedparallel programming library. High-level parallel programming models are in high-demand as they reduce the burdens ondevelopers significantly and provide enough abstraction to accommodate hardware heterogeneity.In this chapter, we present a task-based parallel programming model named XPU which aims to ease parallelismexpression without sacrificing performances. Contrary to many parallel programming models which introduce newlanguages, extend existing language or define compiler annotations and thus require specialized compilers, virtualmachines or extra-hardware... XPU is a pure software technology entirely based on the traditional C++ language andrequires nothing more than a standard C++ compiler to be used, and therefore, improves learning curve steepness and iseasily portable to many systems.We show how XPU exploits C++ metaprogramming techniques to ease expression of several types of parallelismincluding task, data and temporal parallelism at all levels of granularity inside a single structured and homogeneousprogramming model. We describe the XPU parallelization methodology and we show through a practical signal processingapplication how we can apply this methodology to parallelize a sequential program at the cost of a little amount of parallelparadigms-related extra-code while reusing the sequential legacy code without significant alteration. This case studydemonstrates the ability of the XPU programming model to provide high programmability to improve programmerproductivity while delivering high performances.