Automatic Source Code Transformation for GPUs Based on Program Comprehension

  • Pasquale Cantiello
  • Beniamino Di Martino
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7156)


In this work is presented a technique to transform sequential source code to execute it on parallel architectures as heterogeneous many-core systems or GPUs. Source code is parsed and basic algorithmic concepts are discovered from it in order to feed a knowledge base. A reasoner, by consulting algorithmic rules, can compose this basic concepts to pinpoint code regions representing a known algorithm. This code can be annotated and / or transformed with a source-to-source process. A prototype tool has been built and tested on a case study to analyse the source code of a matrix multiplication. After recognition of the algorithm, the code is modified with calls to nVIDIA GPU cuBLAS library.


comprehension GPU manycore source-to-source reengineering 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Baskaran, M.M., Bondhugula, U., Krishnamoorthy, S., Ramanujam, J., Rountev, A., Sadayappan, P.: A compiler framework for optimization of affine loop nests for gpgpus. In: Proceedings of the 22nd Annual International Conference on Supercomputing, ICS 2008, pp. 225–234. ACM, New York (2008)CrossRefGoogle Scholar
  2. 2.
    Baxter, I.D., Yahin, A., Moura, L., Sant’Anna, M., Bier, L.: Clone detection using abstract syntax trees. In: IEEE International Conference on Maintenance (ICSM 1998), p. 368 (1998)Google Scholar
  3. 3.
    Benkner, S.: Vfc: The vienna fortran compiler. Scientific Programming 7, 67–81 (1999)Google Scholar
  4. 4.
    Di Martino, B.: Algorithmic concept recognition to support high performance code reengineering. Special Issue on Hardware/Software Support for High Performance Scientific and Engineering Computing of IEICE Transaction on Information and Systems E87-D, 1743–1750 (2004)Google Scholar
  5. 5.
    Di Martino, B., Iannello, G.: Pap recognizer: A tool for automatic recognition of parallelizable patterns. In: International Workshop on Program Comprehension, p. 164 (1996)Google Scholar
  6. 6.
    Di Martino, B., Kessler, C.W.: Two program comprehension tools for automatic parallelization. IEEE Concurrency 8, 37–47 (2000)CrossRefGoogle Scholar
  7. 7.
    Di Martino, B., Zima, H.P.: Support of automatic parallelization with concept comprehension. Journal of Systems Architecture 45(6-7), 427–439 (1999)CrossRefGoogle Scholar
  8. 8.
    Ducasse, S., Rieger, M., Demeyer, S.: A language independent approach for detecting duplicated code. In: IEEE International Conference on Software Maintenance (ICSM 1999), p. 109 (1999)Google Scholar
  9. 9.
    Ferrante, J., Ottenstein, K.J., Warren, J.D.: The program dependence graph and its use in optimization. ACM Transactions on Programming Languages and Systems (TOPLAS) 9(3) (1987)Google Scholar
  10. 10.
    Gabel, M., Jiang, L., Su, Z.: Scalable detection of semantic clones. In: Proceedings of the 30th International Conference on Software Engineering, ICSE 2008, pp. 321–330. ACM, New York (2008)CrossRefGoogle Scholar
  11. 11.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design patterns: elements of reusable object-oriented software. Addison-Wesley Longman Publishing Co., Inc., Boston (1995)Google Scholar
  12. 12.
    Hall, M., Padua, D., Pingali, K.: Compiler research: the next 50 years. Commununications of the ACM 52, 60–67 (2009)CrossRefGoogle Scholar
  13. 13.
    Jiang, L., Misherghi, G., Su, Z., Glondu, S.: Deckard: Scalable and accurate tree-based detection of code clones. In: Proceedings of the 29th International Conference on Software Engineering, ICSE 2007, pp. 96–105. IEEE Computer Society, Washington, DC (2007)Google Scholar
  14. 14.
    Komondoor, R., Horwitz, S.: Using Slicing to Identify Duplication in Source Code. In: Cousot, P. (ed.) SAS 2001. LNCS, vol. 2126, pp. 40–56. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  15. 15.
    Lee, S., Min, S.-J., Eigenmann, R.: Openmp to gpgpu: a compiler framework for automatic translation and optimization. SIGPLAN Not. 44, 101–110 (2009)CrossRefGoogle Scholar
  16. 16.
    Liao, C., Quinlan, D., Willcock, J., Panas, T.: Extending Automatic Parallelization to Optimize High-Level Abstractions for Multicore. In: Müller, M.S., de Supinski, B.R., Chapman, B.M. (eds.) IWOMP 2009. LNCS, vol. 5568, pp. 28–41. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  17. 17.
    NVIDIA. Cuda: Compute unified device architecture,
  18. 18.
    Quinlan, D.: Rose compiler,
  19. 19.
    Wielemaker, J.: Swi-prolog,

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Pasquale Cantiello
    • Beniamino Di Martino

      There are no affiliations available

      Personalised recommendations