Static Loop Parallelization Decision
Using Template Metaprogramming
 
 
Alexis Pereda, David Hill, Claude Mazel, Bruno Bachelet
(LIMOS, Clermont-Ferrand, France)
 
2018 International Conference on High Performance Computing and Simulation (HPCS)
Orléans, France
July 16-20, 2018
 

This paper proposes to use C++ template metaprogramming techniques to decide at compile-time which parts of a code sequence in a loop can be parallelized. The approach focuses on characterizing the way a variable is accessed in a loop (reading or writing), first to decide how the loop should be split to enable the analysis for parallelization on each part, and then to detect if the iterations inside each loop are independent so that they can be run in parallel.

The conditions that enable the parallelization of a loop are first explained to justify the proposed decision algorithm. Then, a C++ library-based solution is presented that uses expression templates to get the relevant information necessary for the parallelization decision of a loop, and metaprograms to decide whether to parallelize the loop and generate a parallel code.