Dec 15, 2014 - tial programming languages such as C. Possible performance gains of legacy sequential ..... In chips like
Instituto Tecnol´ogico de Costa Rica Electronics Engineering School Master’s Program in Electronics Engineering
Sequential Code Parallelization for Multi-core Embedded Systems: A Survey of Models, Algorithms and Tools
Master’s Thesis in fulfillment of the requirements for the degree of Master of Science in Electronics Engineering Major on Embedded Systems
Submitted by Jorge Alberto Castro God´ınez
December 15, 2014
I declare that this thesis document has been made entirely by my person, using and applying literature on the subject, and introducing my own knowledge and experimental results. In the cases I have used literature, I proceeded to indicate the sources by the respective references. Accordingly, I assume full responsibility for this thesis work and the content of this document.
Jorge Alberto Castro God´ınez B¨ uhl, Germany. December 15, 2014 C´ed.: 1 1236 0930
Instituto Tecnol´ogico de Costa Rica Electronics Engineering School Master’s Thesis Evaluation Committee
Master’s Thesis presented to the Evaluation Committee as a requirement to obtain the Master of Science degree from the Instituto Tecnol´ogico de Costa Rica.
Evaluation Committee Members
The members of the Evaluation Committee certify that this Master’s Thesis has been approved and that fulfills the requirements set by the Electronics Engineering School.
B¨ uhl, Germany. December 15, 2014
Abstract In recent years the industry experienced a shift in the design and manufacture of processors. Multiple-core processors in one single chip started replacing the common used single-core processors. This design trend reached the develop of System-on-Chip, widely used in embedded systems, and turned them into powerful Multiprocessor System-onChip. These multi-core systems have presented not only an improvement in performance but also in energy efficiency. Millions of lines of code have been developed over the years, most of them using sequential programming languages such as C. Possible performance gains of legacy sequential code executed in multi-core systems is limited by the amount of parallelism that can be extracted and exploit from that code. For this reason many tools have been developed to extract parallelism from sequential program and produce a parallel version of the original code. Nevertheless, most of these tools have been designed for high-performance computing systems rather than for embedded systems where multiple constraints must be considered, and a reduction in the execution time is not the only desirable objective. Due there is no definitive solution for parallelizing code, especially for multi-core embedded systems, this work aims to present a survey on some different aspects involved in parallelizing code such as models of code representation, code analysis, parallelism extraction algorithms, parallel programming. Also existing parallelizing tools are presented and compared. This work ends with a recommended list of important key aspects that should be consider when designing and developing a parallelizing compiler, automatic or semiautomatic, for multi-core embedded systems; and when using existing tools to use them Keywords: Parallelism extraction, multi-core embedded systems, representation models, code analysis, parallelizing algorithms, parallelization tools.
to Silvia & Fabiana
Acknowledgments I am deeply grateful for the opportunity to continue with my formal higher education. It have been always my goal to obtain all the education possible. I truly believe that education is the gate to bigger opportunities in life. I would like to thank to MSc. Miguel Aguilar, my thesis’s director, that despite his personal challenges, continued willing to supervise me in this work. Also I thank to MSc. Mar´ıa Rodr´ıguez and Dr. Esteban Meneses for being part of the evaluation committee. I would like to thank the master’s program coordination, in the persons of Dr.-Ing Paola Vega and MSc. Anibal Coto, for their support, help, and collaboration. Also, I thank to my colleagues at the Costa Rica Institute of Technology for their support and encouragement, especially to Dr.-Ing. Pablo Alvarado for his counsel and advise along the time of my master’s studies. I have to recognize and deeply thank to the MICITT (Ministerio de Ciencia, Tecnolog´ıa y Telecomunicaciones), the CONICIT (Consejo Nacional para Investigaciones Cient´ıficas y Tecnol´ogicas) and the Fondo de Incentivos, that made possible the funding for my master studies, by means of a scholarship. Finally, and most important, I thank to my family, especially to Silvia, my wife, who always impulses and motivates me in our life adventures; and to Fabiana, my daughter, who inspires me to do my best everyday.
Jorge Alberto Castro God´ınez B¨ uhl, Germany. February 24, 2015
Contents List of Figures
v
List of Tables
vii
List of Abbreviations 1 Introduction 1.1 The sequential code problem 1.2 Parallelism extraction . . . . 1.3 Scope of this work . . . . . 1.4 Outline . . . . . . . . . . . .
ix
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
2 Background 2.1 Amdahl’s law . . . . . . . . . . . . . . . . . . . . . . . 2.2 Dependencies in code . . . . . . . . . . . . . . . . . . . 2.2.1 """"""""W
#$"%&
!"-"@
!"#"$%&'(
!)*+,"-""!"."/012'3
A"-"@
A"#"B1CD0
56789+:;+69EAF"-"!)8IJ:5!=)69E!)*+,"?"AF"." K677!)=EAF3
56789+:!76=EAF"-" G+;H3
??A
!!"456789+:;+69