Automatic Parallelization of ANSI C to CUDA C Programs

  • Jan KwiatkowskiEmail author
  • Dzanan Bajgoric
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10777)


Writing efficient general-purpose programs for Graphics Processing Units (GPU) is a complex task. In order to be able to program these processors efficiently, one has to understand their intricate architecture, memory subsystem as well as the interaction with the Central Processing Unit (CPU). The paper presents the GAP - an automatic parallelizer designed to translate sequential ANSI C code to parallel CUDA C programs. Developed and implemented compiler was tested on the series of ANSI C programs. The generated code performed very well, achieving significant speed-ups for the programs that expose high degree of data-parallelism. Thus, the idea of applying the automatic parallelization for generating the CUDA C code is feasible and realistic.


Automatic parallelization GAP compiler Loop transformations Data-parallelism 



The authors are grateful to the Czestochowa University of Technology for granting access to GPU platforms provided by the MICLAB project No. POIG.


  1. 1.
    Banerjee, U.: Loop Transformations for Restructuring Compilers: The Foundations. Kluwer Academic Publishers, New York (1993)CrossRefzbMATHGoogle Scholar
  2. 2.
    Banerjee, U.: Loop Transformations for Restructuring Compilers: Loop Parallelization. Kluwer Academic Publishers, New York (1994)Google Scholar
  3. 3.
    Banerjee, U.: Loop Transformations for Restructuring Compilers: Dependence Analysis. Kluwer Academic Publishers, New York (1994)Google Scholar
  4. 4.
    Zima, H., Chapman, B.: Supercompilers for Parallel and Vector Computers. ACM Press, New York (1991)Google Scholar
  5. 5.
    Midkiff, S.M.: Automatic Parallelization: An Overview of Fundamental Compiler Techniques. Morgan Claypool Publishers, California (2012)Google Scholar
  6. 6.
    Allen, R., Kennedy, K.: Automatic loop interchange. In: Proceedings of the SIGPLAN 1984 Symposium on Compiler Construction, Montreal, pp. 233–246 (1984)Google Scholar
  7. 7.
    Allen, R.: Dependence analysis for subscripted variables and its application to program transformations. Ph.D. thesis. Department of Mathematical Sciences, Rice University, Houston (1983)Google Scholar
  8. 8.
    Wolfe, M.J.: Advanced loop interchange. In: Proceedings of the 1986 International Conference on Parallel Processing, St. Charles, Illinois, pp. 536–543 (1986)Google Scholar
  9. 9.
    Wolfe, M.J.: Loop skewing: the wavefront method revisited. Int. J. Parallel Prog. 15(4), 279–293 (1986)CrossRefzbMATHGoogle Scholar
  10. 10.
    Quillere, F., Rajopadhye, S.V., Wilde, D.: Generation of efficient nested loops from polyhedra. Int. J. Parallel Prog. 28(5), 469–498 (2000)CrossRefGoogle Scholar
  11. 11.
    Bondhugula, U.K.R.: Effective automatic parallelization and locality optimization using the polyhedral model. Ph.D. thesis. The Ohio State University, Ohio (2010)Google Scholar
  12. 12.
    Bastoul, C.: Improving data locality in static control programs. Ph.D. thesis. University Paris 6, Pierre et Marie Curie, France (2004)Google Scholar
  13. 13.
    Baskaran, M.M., Ramanujam, J., Sadayappan, P.: Automatic C-to-CUDA code generation for affine programs. In: Gupta, R. (ed.) CC 2010. LNCS, vol. 6011, pp. 244–263. Springer, Heidelberg (2010). CrossRefGoogle Scholar
  14. 14.
    Bajgoric, J.: Automatic parallelization of ANSI C to CUDA C programs. Master thesis. Wroclaw University of Science and Technology, Poland (2016)Google Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Department of Informatics, Faculty of Computer Science and ManagementWroclaw University of Science and TechnologyWroclawPoland
  2. 2.ARM NorwayTrondheimNorway

Personalised recommendations