The Journal of Supercomputing

, Volume 68, Issue 3, pp 1378–1401 | Cite as

The BonaFide C Analyzer: automatic loop-level characterization and coverage measurement

  • Sergio Aldea
  • Diego R. Llanos
  • Arturo Gonzalez-Escribano


The advent of multicore technologies has increased the interest in parallelization techniques for existing sequential applications. These techniques include the need of detecting loops that are good candidates for parallelization, and classifying all variables of these loops according to their use, a task surprisingly hard to be carried out manually. In this paper, we introduce the BonaFide C Analyzer, an XML-based framework that combines static analysis of source code with profiling information to generate complete reports regarding all loops in a C application, including loop coverage, loop suitability for parallelization, a classification of all variables inside loops based on their accesses, and other hurdles that restrict the parallelization. This information allows to analyze how particular language constructs are used in real-world applications, and helps the programmer to parallelize the code. To show the features of the framework, we present the results of an in-depth loop characterization of C applications that are part of the SPEC CPU2006 benchmark suite. Our study shows that 47.72 % of loops present in the applications analyzed are potentially parallelizable with existent parallel programming models such as OpenMP, while an additional 37.7 % of loops could be run in parallel with the help of runtime speculative parallelization techniques.


Automatic parallelization Code analysis Compiler framework Profiling information Source code representation  Source transformation XML 


  1. 1.
    Al-Ekram R, Kontogiannis K (2005) An XML-Based framework for language neutral program representation and generic analysis. In: Proceedings of CSMR’05, pp 42–51Google Scholar
  2. 2.
    Aldea, S, Llanos DR, Gonzalez-Escribano A (2011) Towards a compiler framework for thread-level speculation. In: Proceeding of PDP’11, pp 267–271Google Scholar
  3. 3.
    Aldea S, Llanos DR, Gonzalez-Escribano A (2012) Using SPEC CPU2006 to evaluate the sequential and parallel code generated by commercial and open-source compilers. J Supercomput 2012(59):486–498Google Scholar
  4. 4.
    Atsumi N, Kobayashi T, Yamamoto S, Agusa K (2011) An XML C source code interchange format for CASE tools. In: Proceedings of COMPSAC’11, pp 498–503Google Scholar
  5. 5.
    Badros GJ (2000) JavaML: a markup language for java source code. Comput Netw 33(1):159–177CrossRefGoogle Scholar
  6. 6.
    Berglund A, Boag S, Chamberlin D, Fernandez MF, Kay M, Robie J, Simon J (2010) XML Path language (XPath) 2.0 (Second edition). W3C recommendation 14 Dec 2010. Accessed December 2013
  7. 7.
    Boshernitsan M, Graham SL (2000) Designing an XML-Based exchange format for Harmonia. In: Proceedings of WCRE’00, pp 287–289Google Scholar
  8. 8.
    Bray T, Paoli J, Sperberg-McQueen CM, Maler E, Yergeau F (2008) Extensible Markup Language (XML). W3C Recommendation 26 November 2008. Accessed December 2013
  9. 9.
    Campanoni S, Jones TM, Holloway G, Wei GY, Brooks D (2012) Helix: making the extraction of thread-level parallelism mainstream. IEEE Micro 32(4):8–18CrossRefGoogle Scholar
  10. 10.
    Chamberlain BL, Callahan D, Zima HP (2007) Parallel programmability and the chapel language. Int J HPC Appl 21(3):291–312Google Scholar
  11. 11.
    Chandra R, Menon R, Dagum L, Kohr D, Maydan D, McDonald, J (2000) Parallel Programming in OpenMP, 1 edn. Morgan Kaufmann, BurlingtonGoogle Scholar
  12. 12.
    Chen MK, Olukotun K (2003) The Jrpm system for dynamically parallelizing java programs. In: Proceedings of ISCA’03, pp 434–445Google Scholar
  13. 13.
    Cintra M, Llanos D (2005) Design space exploration of a software speculative parallelization scheme. IEEE Trans Parallel Distrib Syst 16(6):562–576Google Scholar
  14. 14.
    Collard ML (2003) An infrastructure to support meta-differencing and refactoring of source code. In: Proceedings of ASE’03, pp 377–380Google Scholar
  15. 15.
    Collard ML (2005) Addressing source code using srcML. In: IWCP’05 working session textual views of source code to support comprehension, pp 1–3Google Scholar
  16. 16.
    Collard ML, Decker MJ, Maletic JI (2011) Lightweight transformation and fact extraction with the srcML toolkit. In: Proceedings of SCAM’11, pp 173–184Google Scholar
  17. 17.
    Collard ML, Kagdi HH, Maletic, JI (2003) An XML-Based lightweight C++ fact extractor. In: Proceedings of IWPC’03, pp 134–143Google Scholar
  18. 18.
    Collard ML, Maletic JI (2004) Document-oriented source code transformation using XML. In: Proceedings of SET’04, pp 11–14Google Scholar
  19. 19.
    Collard ML, Maletic JI, Robinson BP (2010) A lightweight transformational approach to support large scale adaptive changes. In: Proceedings of ICSM’10, pp 1–10Google Scholar
  20. 20.
    Cordy JR (2003) Generalized selective XML markup of source code using agile parsing. In: Proceedings of IWPC’03, pp 144–153Google Scholar
  21. 21.
    Dave C, Bae H, Min S, Lee S, Eigenmann R, Midkiff S (2009) Cetus: A Source-to-Source compiler infrastructure for multicores. Computer 42(12):36–42CrossRefGoogle Scholar
  22. 22.
    David G, Badros G, Aguiar A (2004) JavaML 2.0: Enriching the markup language for java source code. XML Aplicaes e Tecnologias Associadas (XATA’04)Google Scholar
  23. 23.
    Dou J, Cintra M (2007) A compiler cost model for speculative parallelization. ACM Trans Architect Code Optim 4(2)Google Scholar
  24. 24.
    Du Z, Lim C, Li X, Yang C, Zhao Q, Ngai T (2004) A cost-driven compilation framework for speculative parallelization of sequential programs. In: Proceedings of PLDI’04, pp 71–81Google Scholar
  25. 25.
    Ebert J, Kullbach B, Winter A (1999) GraX an interchange format for reengineering tools. In: Proceedings of WCRE’99, pp 89–98Google Scholar
  26. 26.
    Fischer G, Lusiardi J (2008) JaML—an XML Representation of Java Source code. University of Wrzburg, Tech. RepGoogle Scholar
  27. 27.
    Garcia S, Jeon D, Louie CM, Taylor MB (2012) The kremlin oracle for sequential code parallelization. IEEE Micro 32(4):42–53CrossRefGoogle Scholar
  28. 28.
    Gondow K, Kawashima H (2002) Towards ANSI C program slicing using XML. Electron Notes Theor Comput Sci 65(3):30–49CrossRefGoogle Scholar
  29. 29.
    Henning JL (2006) SPEC CPU2006 benchmark descriptions. SIGARCH Comput Archit News 34(4):1–17CrossRefMathSciNetGoogle Scholar
  30. 30.
    Hertzberg B, Olukotun K (2011) Runtime automatic speculative parallelization. In: Proceedings of CGO’11, pp 64–73Google Scholar
  31. 31.
    Holt RC, Winter A, Schrr A (2000) GXL: toward a standard exchange format. In: Proceedings of WCRE’00, pp 162–171Google Scholar
  32. 32.
    Iverson W (2005) Apache Jakarta Commons: reusable Java(TM) components. Prentice Hall PTR, Upper Saddle River, pp 154–156Google Scholar
  33. 33.
    Johnson TA, Eigenmann R, Vijaykumar TN (2007) Speculative thread decomposition through empirical optimization. In: Proceedings of PPoPP’07, pp 205–214Google Scholar
  34. 34.
    Kay M (2013) XSL Transformations (XSLT) version 2.0. W3C recommendation 23 january 2007. Accessed December 2013
  35. 35.
    Kejariwal A, Tian X, Girkar M, Li W, Kozhukhov S, Banerjee U, Nicolau A, Veidenbaum AV, Polychronopoulos CD (2007) Tight analysis of the performance potential of thread speculation using SPEC CPU 2006. In: Proceedings of PPoPP’07, pp 215–225Google Scholar
  36. 36.
    Kim M, Kim H, Luk C (2010) SD3: a scalable approach to dynamic data-dependence profiling. In: Proceedings of MICRO’43, pp 535–546Google Scholar
  37. 37.
    Liu W, Tuck J, Ceze L, Ahn W, Strauss K, Renau J, Torrellas J (2006) POSH: a TLS compiler that exploits program structure. In: Proceedings of PPoPP’06, pp 158–167Google Scholar
  38. 38.
    Luo Y, Packirisamy V, Hsu W, Zhai A, Mungre N, Tarkas A (2009) Dynamic performance tuning for speculative threads. In: Proceedings of ISPA’09, pp 462–473Google Scholar
  39. 39.
    Maeda K (2007) Experience of XML-based source code representation with parsing actions. In: Proceeding of SoMeT’07, pp 330–339Google Scholar
  40. 40.
    Maletic JI, Collard ML, Kagdi H (2004) Leveraging XML technologies in developing program analysis tools. In: Proceedings of ACSE’04, pp 80–85Google Scholar
  41. 41.
    Mamas E, Kontogiannis K (2000) Towards portable source code representations using XML. In: Proceedings of WCRE’00, pp 172–182Google Scholar
  42. 42.
    Maruyama K, Yamamoto S (2004) A CASE tool platform using an XML representation of java source code. In: Proceedings of SCAM’04, pp 158–167Google Scholar
  43. 43.
    McArthur G, Mylopoulos J, Ng SKK (2002) An extensible tool for source code representation using XML. In: Proceedings of WCRE’02, pp 199–208Google Scholar
  44. 44.
    Mendonca NC, Maia PHM, Fonseca LA, Andrade RMC (2004) RefaX: a refactoring framework based on XML. In: Proceedings of ICSM’04, pp 147–156Google Scholar
  45. 45.
    Moseley T, Connors DA, Grunwald D, Peri R (2007) Identifying potential parallelism via loop-centric profiling. In: Proceedings of CF’07, pp 143–152Google Scholar
  46. 46.
    Packirisamy V, Zhai A, Hsu W, Yew P, Ngai T (2009) Exploring speculative parallelism in SPEC2006. In: Proceedings of ISPASS’09, pp 77–88Google Scholar
  47. 47.
    Power JF, Malloy BA (2002) Program annotation in XML: a Parse-Tree based approach. In: Proceedings of WCRE’02, pp 190–198Google Scholar
  48. 48.
    von Praun C, Bordawekar R, Cascaval C (2008) Modeling optimistic concurrency using quantitative dependence analysis. In: Proceedings of PPoPP’08, pp 185–196Google Scholar
  49. 49.
    Putro HP, Liem I (2011) XML representations of program code. In: Proceedings of ICEEI’11, pp 1–6Google Scholar
  50. 50.
    Salinas-Mendoza A, Juarez-Martinez U, Alor-Hernandez G, Olivares-Zepahua BA (2011) Designing an XML-based representation for CaesarJ source code. In: Proceedings of CERMA’11, pp 427–432Google Scholar
  51. 51.
    Sun YX, Chen HY, Tse TH (2008) Lean implementations of software testing tools using XML representations of source codes. In: Proceedings of CSSE’08, pp 708–711Google Scholar
  52. 52.
    Tian C, Feng M, Gupta R (2010) Speculative parallelization using state separation and multiple value prediction. In: Proceedings of ISMM’10, pp 63–72Google Scholar
  53. 53.
    Tidwell D (2008) XSLT, 2nd 2 edn. O’Reilly Media, SebastopolGoogle Scholar
  54. 54.
    Wagner C, Margaria T, Pagendarm HG (2009) Analysis and code model extraction for C/C++ source code. In: Proceedings of ICECCS’09, pp 110–119Google Scholar
  55. 55.
    Wang S, Dai X, Yellajyosula KS, Zhai A, Yew P (2006) Loop selection for thread-level speculation. In: Proceedings of LCPC’05, pp 289–303Google Scholar
  56. 56.
    Whaley J, Kozyrakis C (2005) Heuristics for profile-driven method-level speculative parallelization. In: Proceedings of ICPP’05, pp 147–156Google Scholar
  57. 57.
    Wheeler DA (2004) Sloccount: counting source lines of code. Accessed December 2013
  58. 58.
    Wu P, Kejariwal A, Cacaval C (2008) Compiler-driven dependence profiling to guide program parallelization. In: Amaral J (ed) Languages and compilers for parallel computing. Lecture notes in computer science, vol 5335, pp 232–248Google Scholar
  59. 59.
    Zou Y, Kontogiannis K (2001) A framework for migrating procedural code to Object-Oriented platforms. In: Proceedings of APSEC’01, APSEC ’01, pp 390–399Google Scholar

Copyright information

© Springer Science+Business Media New York 2014

Authors and Affiliations

  • Sergio Aldea
    • 1
  • Diego R. Llanos
    • 1
  • Arturo Gonzalez-Escribano
    • 1
  1. 1.Dpto. Informática Universidad de ValladolidValladolidSpain

Personalised recommendations